Code example for ServerSocketChannel

Methods: configureBlocking, socket

0
    /** 
     * @tests ServerSocket#socket().accept() 
     */ 
    public void test_socket_accept_Blocking_NotBound() throws IOException { 
        // regression test for Harmony-748 
        ServerSocket gotSocket = serverChannel.socket();
        serverChannel.configureBlocking(true);
        try { 
            gotSocket.accept();
            fail("Should throw an IllegalBlockingModeException");
        } catch (IllegalBlockingModeException e) {
            // expected 
        } 
        serverChannel.close();
        try { 
            gotSocket.accept();
            fail("Should throw an IllegalBlockingModeException");
        } catch (IllegalBlockingModeException e) {
            // expected 
        } 
    }