本文整理汇总了Java中java.net.DatagramSocketImpl类的典型用法代码示例。如果您正苦于以下问题:Java DatagramSocketImpl类的具体用法?Java DatagramSocketImpl怎么用?Java DatagramSocketImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatagramSocketImpl类属于java.net包,在下文中一共展示了DatagramSocketImpl类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DatagramSocketAdapter
import java.net.DatagramSocketImpl; //导入依赖的package包/类
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();
}
}
示例2: testSetDatagramSocketImpl
import java.net.DatagramSocketImpl; //导入依赖的package包/类
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);
}
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:19,代码来源:TestDatagramSocketServlet.java
示例3: boot
import java.net.DatagramSocketImpl; //导入依赖的package包/类
/**
* 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");
}
}
示例4: QoSDatagramSocket
import java.net.DatagramSocketImpl; //导入依赖的package包/类
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);
}
}
示例5: test_ConstructorLjava_net_DatagramSocketImpl
import java.net.DatagramSocketImpl; //导入依赖的package包/类
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
}
}
示例6: test_ConstructorLjava_net_DatagramSocketImpl
import java.net.DatagramSocketImpl; //导入依赖的package包/类
/**
* @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
}
}
示例7: test_ConstructorLjava_net_DatagramSocketImpl
import java.net.DatagramSocketImpl; //导入依赖的package包/类
/**
* @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
}
}
示例8: DatagramSocketAdapter
import java.net.DatagramSocketImpl; //导入依赖的package包/类
DatagramSocketAdapter(DatagramSocketImpl socketimpl,
DatagramChannelImpl channelImpl) {
super(socketimpl);
this.channelImpl = channelImpl;
}
示例9: createDatagramSocketImpl
import java.net.DatagramSocketImpl; //导入依赖的package包/类
public DatagramSocketImpl createDatagramSocketImpl() {
return new TestDatagramSocketImpl();
}
示例10: createDatagramSocketImpl
import java.net.DatagramSocketImpl; //导入依赖的package包/类
public DatagramSocketImpl createDatagramSocketImpl() {
isCreateDatagramSocketImpl = true;
return new TestDatagramSocketImpl();
}
示例11: createDatagramSocketImpl
import java.net.DatagramSocketImpl; //导入依赖的package包/类
public DatagramSocketImpl createDatagramSocketImpl() {
return new PlainDatagramSocketImpl();
}
示例12: getDatagramSocketImpl
import java.net.DatagramSocketImpl; //导入依赖的package包/类
public static DatagramSocketImpl getDatagramSocketImpl() {
return new PlainDatagramSocketImpl();
}
示例13: getMulticastSocketImpl
import java.net.DatagramSocketImpl; //导入依赖的package包/类
public static DatagramSocketImpl getMulticastSocketImpl() {
return new PlainMulticastSocketImpl();
}