Code example for ServerSocketChannel

Methods: configureBlocking, socket

0
    /** 
     * @tests ServerSocket#socket().accept() 
     */ 
    public void test_socket_accept_Blocking_Bound() throws IOException { 
        // regression test for Harmony-748 
        serverChannel.configureBlocking(true);
        ServerSocket gotSocket = serverChannel.socket();
        gotSocket.bind(localAddr1);
        serverChannel.close();
        try { 
            gotSocket.accept();
            fail("Should throw a ClosedChannelException");
        } catch (ClosedChannelException e) {
            // expected 
        } 
    } 
    /** 
     * Regression test for HARMONY-4961 
     */ 
    public void test_socket_getLocalPort() throws IOException { 
        serverChannel.socket().bind(localAddr1);