Code example for ServerSocketChannel

Methods: acceptsocketconfigureBlocking

0
            // OK. 
        } 
    } 
 
    public void testAccept_NonBlock_NoConnect() throws IOException { 
        ServerSocket gotSocket = this.serverChannel.socket();
        gotSocket.bind(localAddr1);
        this.serverChannel.configureBlocking(false);
        // non-blocking mode , will immediately return 
        assertNull(this.serverChannel.accept());
    } 
 
    /** 
     * @tests ServerSocketChannel#accept().socket() 
     */ 
    public void test_read_Blocking_RealData() throws IOException { 
        serverChannel.socket().bind(localAddr1);
        ByteBuffer buf = ByteBuffer.allocate(CAPACITY_NORMAL);
 
        for (int i = 0; i < CAPACITY_NORMAL; i++) {
            buf.put((byte) i);