@Test
  public void basicsTest() throws Exception {
    List<byte[]> inputBuffers = getBuffers(1000, 20, 201, 0, 79, 1005);
    RetainingAsyncWritableChannel channel = new RetainingAsyncWritableChannel();
    for (int i = 0; i < inputBuffers.size(); i++) {
      ByteBuffer buf = ByteBuffer.wrap(inputBuffers.get(i));
      writeAndCheckCallback(buf, channel, buf.remaining(), null, null);
    }
    checkStream(inputBuffers, channel);
    channel.close();
    writeAndCheckCallback(ByteBuffer.allocate(0), channel, 0, ClosedChannelException.class, null);
  }
Test that {@link RetainingAsyncWritableChannel} behaves as expected: chunks are copied, callback completed
immediately after {@link RetainingAsyncWritableChannel#write} method completes.
ambry-commons/src/test/java/com/github/ambry/commons/RetainingAsyncWritableChannelTest.java