@Test public void testDatagramSocketFactoryMakeObject() throws Exception { DatagramSocketFactory socketFactory = new DatagramSocketFactory(); InetSocketAddress socketAddress = new InetSocketAddress(Inet4Address.getLocalHost(), PORT); DatagramSocket socketObject = socketFactory.makeObject(socketAddress); assertThat(socketObject.getPort()).isEqualTo(PORT); assertThat(socketObject.getInetAddress()).isEqualTo(Inet4Address.getLocalHost()); }
@Override public DatagramSocket makeObject(SocketAddress socketAddress) throws Exception { DatagramSocket datagramSocket = new DatagramSocket(); datagramSocket.connect(socketAddress); return datagramSocket; }
DatagramSocketFactory extends BaseKeyedPoolableObjectFactory<SocketAddress, DatagramSocket> { @Override public DatagramSocket makeObject(SocketAddress socketAddress) throws Exception { DatagramSocket datagramSocket = new DatagramSocket(); datagramSocket.connect(socketAddress); return datagramSocket; } }
DatagramSocketFactory extends BaseKeyedPoolableObjectFactory<SocketAddress, DatagramSocket> { @Override public DatagramSocket makeObject(SocketAddress socketAddress) throws Exception { DatagramSocket datagramSocket = new DatagramSocket(); datagramSocket.connect(socketAddress); return datagramSocket; }  }
DatagramSocketFactory extends BaseKeyedPoolableObjectFactory<SocketAddress, DatagramSocket> { @Override public DatagramSocket makeObject(SocketAddress socketAddress) throws Exception { DatagramSocket datagramSocket = new DatagramSocket(); datagramSocket.connect(socketAddress); return datagramSocket; }  @Override DatagramSocket makeObject(SocketAddress socketAddress); @Override void destroyObject(SocketAddress key, DatagramSocket socket); @Override boolean validateObject(SocketAddress key, DatagramSocket socket); }
DatagramSocketFactory extends BaseKeyedPoolableObjectFactory<SocketAddress, DatagramSocket> { @Override public DatagramSocket makeObject(SocketAddress socketAddress) throws Exception { DatagramSocket datagramSocket = new DatagramSocket(); datagramSocket.connect(socketAddress); return datagramSocket; }  @Override DatagramSocket makeObject(SocketAddress socketAddress); @Override void destroyObject(SocketAddress key, DatagramSocket socket); @Override boolean validateObject(SocketAddress key, DatagramSocket socket);  }