public void testTwoBytesAtATime() throws Exception {
final String LINE = "The quick brown fox jumped over the lazy dog";
final byte[] BYTES = LINE.getBytes();
final byte[] buffer = new byte[2];
Reader r = new StringReader(LINE);
ReaderInputStream ris = new ReaderInputStream(r, "UTF-8");
for (int i = 0; i < BYTES.length; i += 2) {
Assert.assertEquals(2, ris.read(buffer));
Assert.assertEquals(BYTES[i], buffer[0]);
Assert.assertEquals(BYTES[i + 1], buffer[1]);
}
Assert.assertEquals(-1, ris.read(buffer));
}