@Test @Ignore public void testCreateSocketReturnsNewInstance() throws Exception { DiscoveryListener listener = mock(DiscoveryListener.class); DiscoveryThread thread = new DiscoveryThread( AndroidNetworkIntents.DEFAULT_MULTICAST_ADDRESS, AndroidNetworkIntents.DEFAULT_PORT, listener ); MulticastSocket socket1 = thread.createSocket(); MulticastSocket socket2 = thread.createSocket(); Assert.assertNotNull(socket1); Assert.assertNotNull(socket2); Assert.assertNotSame(socket1, socket2); }
protected MulticastSocket createSocket() throws UnknownHostException, IOException { InetAddress address = InetAddress.getByName(multicastAddress); MulticastSocket socket = new MulticastSocket(port); socket.joinGroup(address); return socket; }
DiscoveryThread extends Thread { protected MulticastSocket createSocket() throws UnknownHostException, IOException { InetAddress address = InetAddress.getByName(multicastAddress); MulticastSocket socket = new MulticastSocket(port); socket.joinGroup(address); return socket; } }
DiscoveryThread extends Thread { protected MulticastSocket createSocket() throws UnknownHostException, IOException { InetAddress address = InetAddress.getByName(multicastAddress); MulticastSocket socket = new MulticastSocket(port); socket.joinGroup(address); return socket; } DiscoveryThread(String multicastAddress, int port, DiscoveryListener listener); }
DiscoveryThread extends Thread { protected MulticastSocket createSocket() throws UnknownHostException, IOException { InetAddress address = InetAddress.getByName(multicastAddress); MulticastSocket socket = new MulticastSocket(port); socket.joinGroup(address); return socket; } DiscoveryThread(String multicastAddress, int port, DiscoveryListener listener); void run(); void stopDiscovery(); }
DiscoveryThread extends Thread { protected MulticastSocket createSocket() throws UnknownHostException, IOException { InetAddress address = InetAddress.getByName(multicastAddress); MulticastSocket socket = new MulticastSocket(port); socket.joinGroup(address); return socket; } DiscoveryThread(String multicastAddress, int port, DiscoveryListener listener); void run(); void stopDiscovery();  }