private ByteBuffer readBlob(ReadableStreamChannel postContent, Long maxBlobSize)
        throws RouterException, InterruptedException {
      ByteArrayOutputStream blobDataStream = new ByteArrayOutputStream();
      ByteBufferAWC channel = new ByteBufferAWC();
      postContent.readInto(channel, (result, exception) -> channel.close());
      ByteBuffer chunk = channel.getNextChunk();
      IllegalStateException exception = null;
      while (chunk != null) {
        byte[] chunkData = new byte[chunk.remaining()];
        chunk.get(chunkData);
        blobDataStream.write(chunkData, 0, chunkData.length);
        channel.resolveOldestChunk(exception);
        if (exception != null) {
          channel.close();
          throw exception;
        } else {
          chunk = channel.getNextChunk();
        }
      }
      if (maxBlobSize != null && blobDataStream.size() > maxBlobSize) {
        throw new RouterException("Blob exceeded max allowed size: " + maxBlobSize, RouterErrorCode.BlobTooLarge);
      }
      return ByteBuffer.wrap(blobDataStream.toByteArray());
    }
Reads blob data and returns the content as a {@link ByteBuffer}.
@param postContent the blob data.
@param maxBlobSize the max blob size to be enforced, or null for no restriction.
@return the blob data in a {@link ByteBuffer}.
@throws RouterException
@throws InterruptedException
ambry-test-utils/src/main/java/com/github/ambry/router/InMemoryRouter.java