private ByteBuf maybeConvertToComposite(ByteBuf buf) {
    if (!isCompositeByteBuf) {
      return buf.retainedDuplicate();
    } else {
      byte[] data = new byte[buf.readableBytes()];
      buf.getBytes(buf.readerIndex(), data);
      return fromByteArrayToCompositeByteBuf(data);
    }
  }
Convert the given {@link ByteBuf} to a {@link CompositeByteBuf} if the {@code isCompositeByteBuf} is true.
@param buf The given {@link ByteBuf}.
@return The result {@link ByteBuf}.
ambry-router/src/test/java/com/github/ambry/router/CryptoServiceTest.java