private SSLEngineResult handshakeUnwrap(boolean doRead) throws IOException {
    logger.trace("SSLHandshake handshakeUnwrap {}", getConnectionId());
    int read;
    if (doRead) {
      read = readFromSocketChannel();
      if (read == -1) {
        throw new EOFException("EOF during handshake.");
      }
    }
    SSLEngineResult result;
    boolean cont;
    do {
      //prepare the buffer with the incoming data
      netReadBuffer.flip();
      result = sslEngine.unwrap(netReadBuffer, appReadBuffer);
      netReadBuffer.compact();
      handshakeStatus = result.getHandshakeStatus();
      if (result.getStatus() == Status.OK && result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
        handshakeStatus = runDelegatedTasks();
      }
      cont = result.getStatus() == Status.OK && handshakeStatus == HandshakeStatus.NEED_UNWRAP;
      logger.trace("SSLHandshake handshakeUnwrap: handshakeStatus {}", handshakeStatus);
    } while (netReadBuffer.position() != 0 && cont);

    return result;
  }
Perform handshake unwrap
@param doRead boolean
@return SSLEngineResult
@throws IOException
ambry-network/src/main/java/com/github/ambry/network/SSLTransmission.java