java类java.net.DatagramSocketImpl的实例源码

DatagramChannelImpl.java 文件源码 项目:j2objc 阅读 29 收藏 0 点赞 0 评论 0
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();
    }
}
TestDatagramSocketServlet.java 文件源码 项目:appengine-java-vm-runtime 阅读 20 收藏 0 点赞 0 评论 0
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);
}
JikesRVMSocketImpl.java 文件源码 项目:HeraJVM 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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");
  }
}
QoSDatagramSocket.java 文件源码 项目:java-coap 阅读 20 收藏 0 点赞 0 评论 0
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);
    }
}
OldDatagramSocketTest.java 文件源码 项目:In-the-Box-Fork 阅读 16 收藏 0 点赞 0 评论 0
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
    }
}
DatagramSocketTest.java 文件源码 项目:cn1 阅读 20 收藏 0 点赞 0 评论 0
/**
 * @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
    }
}
DatagramSocketTest.java 文件源码 项目:freeVM 阅读 22 收藏 0 点赞 0 评论 0
/**
 * @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
    }
}
DatagramSocketTest.java 文件源码 项目:freeVM 阅读 19 收藏 0 点赞 0 评论 0
/**
 * @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
    }
}
DatagramChannelImpl.java 文件源码 项目:In-the-Box-Fork 阅读 57 收藏 0 点赞 0 评论 0
DatagramSocketAdapter(DatagramSocketImpl socketimpl,
        DatagramChannelImpl channelImpl) {
    super(socketimpl);
    this.channelImpl = channelImpl;
}
OldDatagramSocketTest.java 文件源码 项目:In-the-Box-Fork 阅读 19 收藏 0 点赞 0 评论 0
public DatagramSocketImpl createDatagramSocketImpl() {
    return new TestDatagramSocketImpl();
}
OldDatagramSocketImplFactoryTest.java 文件源码 项目:In-the-Box-Fork 阅读 18 收藏 0 点赞 0 评论 0
public DatagramSocketImpl createDatagramSocketImpl() {
    isCreateDatagramSocketImpl = true;
    return new TestDatagramSocketImpl();
}
DatagramChannelImpl.java 文件源码 项目:cn1 阅读 24 收藏 0 点赞 0 评论 0
DatagramSocketAdapter(DatagramSocketImpl socketimpl,
        DatagramChannelImpl channelImpl) {
    super(socketimpl);
    this.channelImpl = channelImpl;
}
DatagramSocketTest.java 文件源码 项目:cn1 阅读 34 收藏 0 点赞 0 评论 0
public DatagramSocketImpl createDatagramSocketImpl() {
    return new PlainDatagramSocketImpl();
}
DatagramChannelImpl.java 文件源码 项目:freeVM 阅读 25 收藏 0 点赞 0 评论 0
DatagramSocketAdapter(DatagramSocketImpl socketimpl,
        DatagramChannelImpl channelImpl) {
    super(socketimpl);
    this.channelImpl = channelImpl;
}
SocketImplProvider.java 文件源码 项目:freeVM 阅读 25 收藏 0 点赞 0 评论 0
public static DatagramSocketImpl getDatagramSocketImpl() {
    return new PlainDatagramSocketImpl();
}
SocketImplProvider.java 文件源码 项目:freeVM 阅读 17 收藏 0 点赞 0 评论 0
public static DatagramSocketImpl getMulticastSocketImpl() {
    return new PlainMulticastSocketImpl();
}
SocketImplProvider.java 文件源码 项目:freeVM 阅读 17 收藏 0 点赞 0 评论 0
public static DatagramSocketImpl getDatagramSocketImpl(FileDescriptor fd, int localPort) {
    return new PlainDatagramSocketImpl(fd, localPort);
}
DatagramChannelImpl.java 文件源码 项目:freeVM 阅读 23 收藏 0 点赞 0 评论 0
DatagramSocketAdapter(DatagramSocketImpl socketimpl,
        DatagramChannelImpl channelImpl) {
    super(socketimpl);
    this.channelImpl = channelImpl;
}
DatagramSocketTest.java 文件源码 项目:freeVM 阅读 20 收藏 0 点赞 0 评论 0
public DatagramSocketImpl createDatagramSocketImpl() {
    return new PlainDatagramSocketImpl();
}


问题


面经


文章

微信
公众号

扫码关注公众号