public void testPeekAheadInputStream() throws Exception {
ByteArrayInputStream in = new ByteArrayInputStream(new byte[] {0x01, 0x02, 0x03, 0x04});
PeekAheadInputStream pais = new PeekAheadInputStream(in);
byte[] peek = new byte[2];
byte[] read = new byte[2];
pais.peek(peek);
pais.read(read);
assertEquals(read[0], peek[0]);
assertEquals(read[1], peek[1]);
byte[] newread = new byte[2];
assertFalse(read[0] == newread[0]);