예제 #1
0
 /* connect and wait for the connection to complete */
 private String blockingSSLConnect() throws IOException {
   String connectionId =
       selector.connect(
           new InetSocketAddress("localhost", server.port),
           BUFFER_SIZE,
           BUFFER_SIZE,
           PortType.SSL);
   while (!selector.connected().contains(connectionId)) {
     selector.poll(10000L);
   }
   return connectionId;
 }
예제 #2
0
 @Test
 public void testSSLConnect() throws IOException {
   String connectionId =
       selector.connect(
           new InetSocketAddress("localhost", server.port),
           BUFFER_SIZE,
           BUFFER_SIZE,
           PortType.SSL);
   while (!selector.connected().contains(connectionId)) {
     selector.poll(10000L);
   }
   Assert.assertTrue(
       "Channel should have been ready by now ", selector.isChannelReady(connectionId));
 }