@Test
  public void bufferModificationTest() throws Exception {
    byte[] inputBuffer = TestUtils.getRandomBytes(100);
    try (RetainingAsyncWritableChannel channel = new RetainingAsyncWritableChannel()) {
      writeAndCheckCallback(ByteBuffer.wrap(inputBuffer), channel, inputBuffer.length, null, null);
      // mutate the input array and check that stream still matches the original content.
      byte[] originalBuffer = Arrays.copyOf(inputBuffer, inputBuffer.length);
      inputBuffer[50]++;
      checkStream(Collections.singletonList(originalBuffer), channel);
    }
  }
Ensure that buffers are copied and changes to the input buffers after a write call are not reflected in the
returned stream.
ambry-commons/src/test/java/com/github/ambry/commons/RetainingAsyncWritableChannelTest.java