@Test
public void testReadBytes() throws IOException {

  try (LimitInputStream limitInputStream =
    new LimitInputStream(new RandomInputStream(), 128)) {
    Random r = new Random(0);
    byte[] data = new byte[4];
    byte[] expected = { (byte) r.nextInt(), (byte) r.nextInt(),
                        (byte) r.nextInt(), (byte) r.nextInt() };
    limitInputStream.read(data, 0, 4);
    assertArrayEquals("Incorrect bytes returned", expected, data);
  }
}