protected final PreambleResponse processPreamble(ByteBuffer preambleBuffer) throws IOException {
    assert preambleBuffer.remaining() == 6;
    if (
      ByteBufferUtils.equals(preambleBuffer, preambleBuffer.position(), 6,
        RpcClient.REGISTRY_PREAMBLE_HEADER, 0, 6) && doConnectionRegistryResponse()
    ) {
      return PreambleResponse.CLOSE;
    }
    if (
      ByteBufferUtils.equals(preambleBuffer, preambleBuffer.position(), 6,
        RpcClient.SECURITY_PREAMBLE_HEADER, 0, 6)
    ) {
      doSecurityPreambleResponse();
      return PreambleResponse.CONTINUE;
    }
    if (!ByteBufferUtils.equals(preambleBuffer, preambleBuffer.position(), 4, RPC_HEADER, 0, 4)) {
      doBadPreambleHandling(
        "Expected HEADER=" + Bytes.toStringBinary(RPC_HEADER) + " but received HEADER="
          + Bytes.toStringBinary(
            ByteBufferUtils.toBytes(preambleBuffer, preambleBuffer.position(), RPC_HEADER.length),
            0, RPC_HEADER.length)
          + " from " + toString());
      return PreambleResponse.CLOSE;
    }
    int version = preambleBuffer.get(preambleBuffer.position() + 4) & 0xFF;
    byte authByte = preambleBuffer.get(preambleBuffer.position() + 5);
    if (version != RpcServer.CURRENT_VERSION) {
      String msg = getFatalConnectionString(version, authByte);
      doBadPreambleHandling(msg, new WrongVersionException(msg));
      return PreambleResponse.CLOSE;
    }

    this.provider = this.saslProviders.selectProvider(authByte);
    if (this.provider == null) {
      String msg = getFatalConnectionString(version, authByte);
      doBadPreambleHandling(msg, new BadAuthException(msg));
      return PreambleResponse.CLOSE;
    }
    // TODO this is a wart while simple auth'n doesn't go through sasl.
    if (this.rpcServer.isSecurityEnabled && isSimpleAuthentication()) {
      if (this.rpcServer.allowFallbackToSimpleAuth) {
        this.rpcServer.metrics.authenticationFallback();
        authenticatedWithFallback = true;
      } else {
        AccessDeniedException ae = new AccessDeniedException("Authentication is required");
        doRespond(getErrorResponse(ae.getMessage(), ae));
        return PreambleResponse.CLOSE;
      }
    }
    if (!this.rpcServer.isSecurityEnabled && !isSimpleAuthentication()) {
      doRawSaslReply(SaslStatus.SUCCESS, new IntWritable(SaslUtil.SWITCH_TO_SIMPLE_AUTH), null,
        null);
      provider = saslProviders.getSimpleProvider();
      // client has already sent the initial Sasl message and we
      // should ignore it. Both client and server should fall back
      // to simple auth from now on.
      skipInitialSaslHandshake = true;
    }
    useSasl = !(provider instanceof SimpleSaslServerAuthenticationProvider);
    return PreambleResponse.SUCCEED;
  }
Has the request header and the request param and optionally encoded data buffer all in this one
array.
<p/>
Will be overridden in tests.
hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java