Java 类java.net.DatagramSocketImpl 实例源码

项目:j2objc    文件:DatagramChannelImpl.java   
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();
    }
}
项目:appengine-java-vm-runtime    文件:TestDatagramSocketServlet.java   
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);
}
项目:HeraJVM    文件:JikesRVMSocketImpl.java   
/**
 * 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");
  }
}
项目:java-coap    文件:QoSDatagramSocket.java   
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);
    }
}
项目:In-the-Box-Fork    文件:OldDatagramSocketTest.java   
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
    }
}
项目:cn1    文件:DatagramSocketTest.java   
/**
 * @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
    }
}
项目:freeVM    文件:DatagramSocketTest.java   
/**
 * @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
    }
}
项目:freeVM    文件:DatagramSocketTest.java   
/**
 * @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
    }
}
项目:In-the-Box-Fork    文件:DatagramChannelImpl.java   
DatagramSocketAdapter(DatagramSocketImpl socketimpl,
        DatagramChannelImpl channelImpl) {
    super(socketimpl);
    this.channelImpl = channelImpl;
}
项目:In-the-Box-Fork    文件:OldDatagramSocketTest.java   
public DatagramSocketImpl createDatagramSocketImpl() {
    return new TestDatagramSocketImpl();
}
项目:In-the-Box-Fork    文件:OldDatagramSocketImplFactoryTest.java   
public DatagramSocketImpl createDatagramSocketImpl() {
    isCreateDatagramSocketImpl = true;
    return new TestDatagramSocketImpl();
}
项目:cn1    文件:DatagramChannelImpl.java   
DatagramSocketAdapter(DatagramSocketImpl socketimpl,
        DatagramChannelImpl channelImpl) {
    super(socketimpl);
    this.channelImpl = channelImpl;
}
项目:cn1    文件:DatagramSocketTest.java   
public DatagramSocketImpl createDatagramSocketImpl() {
    return new PlainDatagramSocketImpl();
}
项目:freeVM    文件:DatagramChannelImpl.java   
DatagramSocketAdapter(DatagramSocketImpl socketimpl,
        DatagramChannelImpl channelImpl) {
    super(socketimpl);
    this.channelImpl = channelImpl;
}
项目:freeVM    文件:SocketImplProvider.java   
public static DatagramSocketImpl getDatagramSocketImpl() {
    return new PlainDatagramSocketImpl();
}
项目:freeVM    文件:SocketImplProvider.java   
public static DatagramSocketImpl getMulticastSocketImpl() {
    return new PlainMulticastSocketImpl();
}
项目:freeVM    文件:SocketImplProvider.java   
public static DatagramSocketImpl getDatagramSocketImpl(FileDescriptor fd, int localPort) {
    return new PlainDatagramSocketImpl(fd, localPort);
}
项目:freeVM    文件:DatagramChannelImpl.java   
DatagramSocketAdapter(DatagramSocketImpl socketimpl,
        DatagramChannelImpl channelImpl) {
    super(socketimpl);
    this.channelImpl = channelImpl;
}
项目:freeVM    文件:DatagramSocketTest.java   
public DatagramSocketImpl createDatagramSocketImpl() {
    return new PlainDatagramSocketImpl();
}