public static byte[] getResponseBody(ReadableStreamChannel channel) throws Exception {
    RetainingAsyncWritableChannel asyncWritableChannel = new RetainingAsyncWritableChannel((int) channel.getSize());
    channel.readInto(asyncWritableChannel, null).get();
    byte[] result = new byte[(int) asyncWritableChannel.getBytesWritten()];
    asyncWritableChannel.consumeContentAsByteBuf().readBytes(result);
    return result;
  }
Reads the response received from the {@code channel}.
@param channel the {@link ReadableStreamChannel} that contains the response
@return the response in byte array.
@throws Exception
ambry-rest/src/test/java/com/github/ambry/rest/RestTestUtils.java