public void testEncodeBool() throws IOException { final boolean[] input = new boolean[] {true, false}; final byte[] expected = new byte[] {(byte) 0x01, (byte) 0x00}; ByteArrayOutputStream output = new ByteArrayOutputStream(expected.length); Encoder e = new Encoder(output); for (boolean bool : input) { e.bool(bool); } Assert.assertArrayEquals(expected, output.toByteArray()); }