@Test public void parseInvalidHeader() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); CData.writeU16(out, 2); InputStream in = prot.parseHeader(new ByteArrayInputStream(out.toByteArray())); assertNull(in); }
@Test public void parseValidHeader() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); CData.writeU16(out, 2); CData.writeU16(out, 1337); InputStream in = prot.parseHeader(new ByteArrayInputStream(out.toByteArray())); assertEquals(2, in.available()); assertEquals(1337, CData.readU16(in)); assertTrue(in instanceof MessageInputStream); }