@Test
public void testEmptyRead() throws Exception {

  InputStream stream = mock(InputStream.class);
  when(stream.read(any(byte[].class), anyInt(), anyInt()))
          .thenReturn(-1);
  DelimitedStreamReader r = new DelimitedStreamReader(stream, Charsets.UTF_8, 10);
  try {
    r.read(10);
    fail();
  } catch (IOException e) {
    // expected
  }
}