private void saslReadAndProcess(ByteBuff saslToken) throws IOException, InterruptedException {
    if (saslContextEstablished) {
      RpcServer.LOG.trace("Read input token of size={} for processing by saslServer.unwrap()",
        saslToken.limit());
      if (!useWrap) {
        processOneRpc(saslToken);
      } else {
        byte[] b = saslToken.hasArray() ? saslToken.array() : saslToken.toBytes();
        byte[] plaintextData = saslServer.unwrap(b, 0, b.length);
        // release the request buffer as we have already unwrapped all its content
        callCleanupIfNeeded();
        processUnwrappedData(plaintextData);
      }
    } else {
      byte[] replyToken;
      try {
        try {
          getOrCreateSaslServer();
        } catch (Exception e) {
          RpcServer.LOG.error("Error when trying to create instance of HBaseSaslRpcServer "
            + "with sasl provider: " + provider, e);
          throw e;
        }
        RpcServer.LOG.debug("Created SASL server with mechanism={}",
          provider.getSaslAuthMethod().getAuthMethod());
        RpcServer.LOG.debug(
          "Read input token of size={} for processing by saslServer." + "evaluateResponse()",
          saslToken.limit());
        replyToken = saslServer
          .evaluateResponse(saslToken.hasArray() ? saslToken.array() : saslToken.toBytes());
      } catch (IOException e) {
        RpcServer.LOG.debug("Failed to execute SASL handshake", e);
        Throwable sendToClient = HBaseSaslRpcServer.unwrap(e);
        doRawSaslReply(SaslStatus.ERROR, null, sendToClient.getClass().getName(),
          sendToClient.getLocalizedMessage());
        this.rpcServer.metrics.authenticationFailure();
        String clientIP = this.toString();
        // attempting user could be null
        RpcServer.AUDITLOG.warn("{}{}: {}", RpcServer.AUTH_FAILED_FOR, clientIP,
          saslServer.getAttemptingUser());
        throw e;
      } finally {
        // release the request buffer as we have already unwrapped all its content
        callCleanupIfNeeded();
      }
      if (replyToken != null) {
        if (RpcServer.LOG.isDebugEnabled()) {
          RpcServer.LOG.debug("Will send token of size " + replyToken.length + " from saslServer.");
        }
        doRawSaslReply(SaslStatus.SUCCESS, new BytesWritable(replyToken), null, null);
      }
      if (saslServer.isComplete()) {
        finishSaslNegotiation();
        String qop = saslServer.getNegotiatedQop();
        useWrap = qop != null && !"auth".equalsIgnoreCase(qop);
        saslContextEstablished = true;
      }
    }
  }
Reads calls from a connection and queues them for handling.
hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleServerRpcConnection.java