DataByteArrayOutputStream output = new DataByteArrayOutputStream();
wireFormat.marshal(connect.encode(), output);
Buffer marshalled = output.toBuffer();
DataByteArrayInputStream input = new DataByteArrayInputStream(marshalled);
codec.parse(input, marshalled.length());
assertTrue(!frames.isEmpty());
assertEquals(1, frames.size());
connect = new CONNECT().decode(frames.get(0));
LOG.info("Unmarshalled: {}", connect);
assertTrue(connect.cleanSession());
frames.clear();
SUBSCRIBE subscribe = new SUBSCRIBE();
subscribe.topics(new Topic[] {new Topic("TEST", QoS.EXACTLY_ONCE) });
output = new DataByteArrayOutputStream();
wireFormat.marshal(subscribe.encode(), output);
marshalled = output.toBuffer();
input = new DataByteArrayInputStream(marshalled);
codec.parse(input, marshalled.length());
assertTrue(!frames.isEmpty());
assertEquals(1, frames.size());