private CompositeByteBuf fromByteArrayToCompositeByteBuf(byte[] data) {
    int size = data.length;
    ByteBuf toEncrypt = Unpooled.wrappedBuffer(data);
    CompositeByteBuf composite = new CompositeByteBuf(toEncrypt.alloc(), toEncrypt.isDirect(), size);
    int start = 0;
    int end = 0;
    for (int j = 0; j < 3; j++) {
      start = end;
      end = TestUtils.RANDOM.nextInt(size / 2 - 1) + end;
      if (j == 2) {
        end = size;
      }
      ByteBuf c = Unpooled.buffer(end - start);
      c.writeBytes(data, start, end - start);
      composite.addComponent(true, c);
    }
    return composite;
  }
Create a {@link CompositeByteBuf} from the given byte array.
@param data the byte array.
@return A {@link CompositeByteBuf}.
ambry-router/src/test/java/com/github/ambry/router/CryptoServiceTest.java