public ByteBuffer getNextChunk(long timeoutInMs) throws InterruptedException {
    ByteBuffer chunkBuf = null;
    if (isOpen()) {
      chunkBuf = getChunkBuffer(chunks.poll(timeoutInMs, TimeUnit.MILLISECONDS));
    }
    return chunkBuf;
  }
Gets the next chunk of data as a {@link ByteBuffer}.
<p/>
If the channel is not closed, this function waits for {@code timeoutInMs} ms for a chunk. If the channel is closed
or if {@code timeoutInMs} expires, this function returns {@code null}.
@param timeoutInMs the time in ms to wait for a chunk.
@return a {@link ByteBuffer} representing the next chunk of data if the channel is not closed and a chunk becomes
         available within {@code timeoutInMs}. {@code null} if the channel is closed or if {@code timeoutInMs}
         expires.
@throws InterruptedException if the wait for a chunk is interrupted.
ambry-test-utils/src/main/java/com/github/ambry/router/ByteBufferAWC.java