boolean processBytesFromPeer ( ByteBuf data ) throws GeneralSecurityException { checkState ( unwrapper != null , "protector already created" ) ; try ( BufUnwrapper unwrapper = this . unwrapper ) { int bytesRead = 0 ; boolean done = false ; for ( ByteBuffer nioBuffer : unwrapper . readableNioBuffers ( data ) ) { if ( ! nioBuffer . hasRemaining ( ) ) { // This buffer has been fully read, continue to the next buffer. continue ; } int prevPos = nioBuffer . position ( ) ; done = internalHandshaker . processBytesFromPeer ( nioBuffer ) ; bytesRead += nioBuffer . position ( ) - prevPos ; if ( done ) { break ; } } data . readerIndex ( data . readerIndex ( ) + bytesRead ) ; return done ; } }
Process handshake data received from the remote peer .