private void doReadByteByByteTest(InputStream stream, byte[] in) throws IOException {
    for (int i = 0; i < in.length; i++) {
      assertEquals("Byte [" + i + "] does not match expected", in[i], (byte) stream.read());
    }
    assertEquals("Did not receive expected EOF", -1, stream.read());
  }
Tests reading {@link InputStream} byte by byte.
@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