@Override
  protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
    int readableBytes = in.readableBytes();
    if (readableBytes < 4) {
      return;
    }
    int offset = in.readerIndex();
    int status = in.getInt(offset);
    if (status == SaslStatus.SUCCESS.state) {
      ByteBuf challenge = tryDecodeChallenge(in, offset + 4, readableBytes - 4);
      if (challenge != null) {
        out.add(challenge);
      }
    } else {
      tryDecodeError(in, offset + 4, readableBytes - 4);
    }
  }
Decode the sasl challenge sent by RpcServer.
hbase-client/src/main/java/org/apache/hadoop/hbase/security/SaslChallengeDecoder.java