类java.net.DatagramSocketImpl源码实例Demo

下面列出了怎么用java.net.DatagramSocketImpl的API类实例代码及写法,或者点击链接到github查看源代码。

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);
}
 
 类所在包
 类方法
 同包方法