question: public void testDirectSockets_largeWrite_NotAccepted ( ) throws IOException , InterruptedException { final Random r = new Random ( ) ; final InetSocketAddress serverAddr = new InetSocketAddress ( getPort ( 0 ) ) ; final ServerSocket ss = new ServerSocket ( ) ; try { final int receiveBufferSize = ss . getReceiveBufferSize ( ) ; final byte [ ] largeBuffer = new byte [ receiveBufferSize * 10 ] ; if ( log . isInfoEnabled ( ) ) { log . info ( "receiveBufferSize=" + receiveBufferSize + ", largeBufferSize=" + largeBuffer . length ) ; } r . nextBytes ( largeBuffer ) ; ss . bind ( serverAddr ) ; final SocketChannel cs = SocketChannel . open ( ) ; try { final boolean immediate = cs . connect ( serverAddr ) ; if ( ! immediate ) { if ( ! cs . finishConnect ( ) ) { fail ( "Did not connect." ) ; } } assertTimeout ( 10L , TimeUnit . SECONDS , new WriteBufferTask ( cs , ByteBuffer . wrap ( largeBuffer ) ) ) ; accept ( ss ) ; } finally { cs . close ( ) ; } } finally { ss . close ( ) ; } }
target:  Test of a large write on a socket to understand what happens when the write is greater than the combined size of the client send buffer and the server receive buffer and the server side of the socket is either not accepted or already shutdown.