private SSLEngineResult unwrap() throws SSLException {
  if (appBuffer == null) {
    appBuffer=IoBuffer.allocate(inNetBuffer.remaining());
  }
 else {
    appBuffer.expand(inNetBuffer.remaining());
  }
  SSLEngineResult res;
  Status status=null;
  HandshakeStatus handshakeStatus=null;
  do {
    res=sslEngine.unwrap(inNetBuffer.buf(),appBuffer.buf());
    status=res.getStatus();
    handshakeStatus=res.getHandshakeStatus();
    if (status == SSLEngineResult.Status.BUFFER_OVERFLOW) {
      appBuffer.capacity(appBuffer.capacity() << 1);
      appBuffer.limit(appBuffer.capacity());
      continue;
    }
  }
 while (((status == SSLEngineResult.Status.OK) || (status == SSLEngineResult.Status.BUFFER_OVERFLOW)) && ((handshakeStatus == SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) || (handshakeStatus == SSLEngineResult.HandshakeStatus.NEED_UNWRAP)));
  return res;
}

private SSLEngineResult unwrap ( ) throws SSLException { if ( appBuffer == null ) { appBuffer = IoBuffer . allocate ( inNetBuffer . remaining ( ) ) ; } else { appBuffer . expand ( inNetBuffer . remaining ( ) ) ; } SSLEngineResult res ; Status status = null ; HandshakeStatus handshakeStatus = null ; do { res = sslEngine . unwrap ( inNetBuffer . buf ( ) , appBuffer . buf ( ) ) ; status = res . getStatus ( ) ; handshakeStatus = res . getHandshakeStatus ( ) ; if ( status == SSLEngineResult . Status . BUFFER_OVERFLOW ) { appBuffer . capacity ( appBuffer . capacity ( ) << 1 ) ; appBuffer . limit ( appBuffer . capacity ( ) ) ; continue ; } } while ( ( ( status == SSLEngineResult . Status . OK ) || ( status == SSLEngineResult . Status . BUFFER_OVERFLOW ) ) && ( ( handshakeStatus == SSLEngineResult . HandshakeStatus . NOT_HANDSHAKING ) || ( handshakeStatus == SSLEngineResult . HandshakeStatus . NEED_UNWRAP ) ) ) ; return res ; }
decrypt the incoming buffer and move the decrypted data to an application buffer .
