question: public Client ( final ServerSocketChannel server ) throws IOException { try { client = server . accept ( ) ; client . configureBlocking ( false ) ; if ( ! client . finishConnect ( ) ) throw new IOException ( "Upstream client not connected" ) ; clientSelector = Selector . open ( ) ; clientKey = client . register ( clientSelector , SelectionKey . OP_READ ) ; if ( log . isInfoEnabled ( ) ) log . info ( "Accepted new connection" ) ; } catch ( IOException ex ) { close ( ) ; throw ex ; } }
target:  Gets the client connection and open the channel in a non-blocking mode so we will read whatever is available and loop until all data has been read.