@Override
      public ByteBuf readChunk(ByteBufAllocator allocator) throws Exception {
        ByteBuf buf = null;
        if (streamed == 0) {
          startTime = System.currentTimeMillis();
        }
        if (!isEndOfInput()) {
          long currentChunkSendTime = System.currentTimeMillis();
          int remaining = (totalSize - streamed) > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) (totalSize - streamed);
          int toWrite = Math.min(chunk.length, remaining);
          buf = Unpooled.wrappedBuffer(chunk, 0, toWrite);
          streamed += toWrite;
          if (lastChunkSendTime > 0) {
            perfClientMetrics.delayBetweenChunkSendInMs.update(currentChunkSendTime - lastChunkSendTime);
          }
          lastChunkSendTime = currentChunkSendTime;
        }
        return buf;
      }
Creates an instance that repeatedly sends the same chunk up to the configured size.
ambry-tools/src/main/java/com/github/ambry/tools/perf/rest/NettyPerfClient.java