@Override
  public Future<Long> readInto(AsyncWritableChannel asyncWritableChannel, Callback<Long> callback) {
    Future<Long> future;
    if (!channelOpen.get()) {
      ClosedChannelException closedChannelException = new ClosedChannelException();
      FutureResult<Long> futureResult = new FutureResult<Long>();
      futureResult.done(0L, closedChannelException);
      future = futureResult;
      if (callback != null) {
        callback.onCompletion(0L, closedChannelException);
      }
    } else {
      future = asyncWritableChannel.write(buf, new Callback<Long>() {
        @Override
        public void onCompletion(Long result, Exception exception) {
          buf.release();
          if (callback != null) {
            callback.onCompletion(result, exception);
          }
        }
      });
    }
    return future;
  }
Constructs a {@link ReadableStreamChannel} whose read operations return data from the provided {@code buf}.
@param buf the {@link ByteBuf} that is used to retrieve data from on invocation of read operations.
ambry-test-utils/src/main/java/com/github/ambry/commons/ByteBufReadableStreamChannel.java