private void doReadAllAtOnceTest(InputStream stream, byte[] in) throws IOException {
    byte[] out = new byte[in.length];
    assertEquals("Bytes read did not match size of source array", in.length, stream.read(out));
    assertArrayEquals("Byte array obtained from InputStream did not match source", in, out);
    if (out.length > 0) {
      assertEquals("Did not receive expected EOF", -1, stream.read(out));
    }
    assertEquals("Did not receive expected EOF", -1, stream.read());
  }
Tests reading {@link InputStream} all at once.
@param stream the {@link InputStream} to test.
@param in the original data that is inside {@code stream}.
@throws IOException
ambry-commons/src/test/java/com/github/ambry/commons/ReadableStreamChannelInputStreamTest.java