DatagramSocketAdapter(DatagramSocketImpl socketimpl, DatagramChannelImpl channelImpl) { super(socketimpl); this.channelImpl = channelImpl; // Sync state socket state with the channel it is being created from if (channelImpl.isBound) { onBind(channelImpl.localAddress, channelImpl.localPort); } if (channelImpl.connected) { onConnect( channelImpl.connectAddress.getAddress(), channelImpl.connectAddress.getPort()); } else { onDisconnect(); } if (!channelImpl.isOpen()) { onClose(); } }
private void testSetDatagramSocketImpl(HttpServletResponse response) throws IOException, AssertionFailedException { DatagramSocketImplFactory mockFactory = new DatagramSocketImplFactory() { @Override public DatagramSocketImpl createDatagramSocketImpl() { return null; } }; SocketException caught = null; try { DatagramSocket.setDatagramSocketImplFactory(mockFactory); } catch (SocketException e) { caught = e; } assertNotNull("caught", caught, response); }
/** * Set up socket factories to use JikesRVMSocketImpl */ public static void boot() { try { Socket.setSocketImplFactory(new SocketImplFactory() { public SocketImpl createSocketImpl() { return new JikesRVMSocketImpl(); } }); ServerSocket.setSocketFactory(new SocketImplFactory() { public SocketImpl createSocketImpl() { return new JikesRVMSocketImpl(); } }); DatagramSocket.setDatagramSocketImplFactory(new DatagramSocketImplFactory() { public DatagramSocketImpl createDatagramSocketImpl() { throw new VM_UnimplementedError("Need to implement JikesRVMDatagramSocketImpl"); } }); } catch (java.io.IOException e) { VM.sysFail("trouble setting socket impl factories"); } }
public QoSDatagramSocket(SocketAddress bindSocketAddress) throws SocketException { super(bindSocketAddress); try { Field implField = DatagramSocket.class.getDeclaredField("impl"); implField.setAccessible(true); this.impl = (DatagramSocketImpl) implField.get(this); } catch (Exception ex) { throw new RuntimeException(ex); } }
public void test_ConstructorLjava_net_DatagramSocketImpl() { class testDatagramSocket extends DatagramSocket { public testDatagramSocket(DatagramSocketImpl impl){ super(impl); } } try { new testDatagramSocket((DatagramSocketImpl) null); fail("exception expected"); } catch (NullPointerException ex) { //expected } }
/** * @tests java.net.DatagramSocket#DatagramSocket(java.net.DatagramSocketImpl) */ public void test_ConstructorLjava_net_DatagramSocketImpl() { class SimpleTestDatagramSocket extends DatagramSocket { public SimpleTestDatagramSocket(DatagramSocketImpl impl) { super(impl); } } try { new SimpleTestDatagramSocket((DatagramSocketImpl) null); fail("exception expected"); } catch (NullPointerException ex) { // expected } }
/** * @tests java.net.DatagramSocket#DatagramSocket(java.net.DatagramSocketImpl) */ public void test_ConstructorLjava_net_DatagramSocketImpl() { class testDatagramSocket extends DatagramSocket { public testDatagramSocket(DatagramSocketImpl impl){ super(impl); } } try { new testDatagramSocket((DatagramSocketImpl) null); fail("exception expected"); } catch (NullPointerException ex) { //expected } }
DatagramSocketAdapter(DatagramSocketImpl socketimpl, DatagramChannelImpl channelImpl) { super(socketimpl); this.channelImpl = channelImpl; }
public DatagramSocketImpl createDatagramSocketImpl() { return new TestDatagramSocketImpl(); }
public DatagramSocketImpl createDatagramSocketImpl() { isCreateDatagramSocketImpl = true; return new TestDatagramSocketImpl(); }
public DatagramSocketImpl createDatagramSocketImpl() { return new PlainDatagramSocketImpl(); }
public static DatagramSocketImpl getDatagramSocketImpl() { return new PlainDatagramSocketImpl(); }
public static DatagramSocketImpl getMulticastSocketImpl() { return new PlainMulticastSocketImpl(); }
public static DatagramSocketImpl getDatagramSocketImpl(FileDescriptor fd, int localPort) { return new PlainDatagramSocketImpl(fd, localPort); }