ApplicationMessageSerializer extends ProtocolMessageSerializer<ApplicationMessage> { @Override public byte[] serializeProtocolMessageContent() { LOGGER.debug("Serializing ApplicationMessage"); writeData(msg); return getAlreadySerialized(); } ApplicationMessageSerializer(ApplicationMessage message, ProtocolVersion version); @Override byte[] serializeProtocolMessageContent();  }
@Test public void testSerializeProtocolMessageContent() { ApplicationMessage message = new ApplicationMessage(); message.setData(data); message.setCompleteResultingMessage(expectedPart); ApplicationMessageSerializer serializer = new ApplicationMessageSerializer(message, ProtocolVersion.TLS12); assertArrayEquals(expectedPart, serializer.serialize()); }