private void stopMDNS() throws IOException { if (jmdns != null) { for (JmDNS mdns : jmdns) { if (mdns == null) { continue; } Log.i(TAG, "Stopping GameClient discovery " + mdns.getName()); mdns.removeServiceListener(SERVICE_TYPE, GameClient.this); mdns.close(); mdns = null; } } }