private ByteBuffer getChunkBuffer(ChunkData chunkData) {
    ByteBuffer chunkBuf = null;
    if (chunkData != null && chunkData.buffer != null) {
      chunkBuf = chunkData.buffer;
      chunksAwaitingResolution.add(chunkData);
      if (!isOpen()) {
        chunkBuf = null;
        resolveAllRemainingChunks(new ClosedChannelException());
      }
    }
    return chunkBuf;
  }
Gets the buffer associated with the chunk if there is one. Also updates internal state.
@param chunkData the data associated with the chunk whose buffer needs to be returned.
@return the buffer inside {@code chunkData} if there is one.
ambry-test-utils/src/main/java/com/github/ambry/router/ByteBufferAWC.java