Code example for SocketChannel

Methods: connect

0
    /** 
     * Regression test for HARMONY-4961 
     */ 
    public void test_socket_getLocalPort() throws IOException { 
        serverChannel.socket().bind(localAddr1);
        clientChannel.connect(localAddr1);
        SocketChannel myChannel = serverChannel.accept();
        int port = myChannel.socket().getLocalPort();
        assertEquals(localAddr1.getPort(), port);
        myChannel.close();
        clientChannel.close();
        serverChannel.close();
    } 
 
    /** 
     * Regression test for HARMONY-6375 
     */ 
    public void test_accept_configureBlocking() throws Exception { 
        InetSocketAddress localAddr = new InetSocketAddress("localhost", 0);
        serverChannel.socket().bind(localAddr);