SSL2ClientMasterKeySerializer extends ProtocolMessageSerializer<SSL2ClientMasterKeyMessage> { @Override public byte[] serializeProtocolMessageContent() { LOGGER.debug("Serializing SSL2ClientMasterKey"); writeMessageLength(msg); writeType(msg); writeCipherKind(msg); writeClearKeyLength(msg); writeEncryptedKeyLength(msg); writeKeyArgLength(msg); writeClearKeyData(msg); writeEncryptedKeyData(msg); writeKeyArgData(msg); return getAlreadySerialized(); } SSL2ClientMasterKeySerializer(SSL2ClientMasterKeyMessage message, ProtocolVersion version); @Override byte[] serializeProtocolMessageContent(); void writeKeyArgData(SSL2ClientMasterKeyMessage msg);  }
@Test public void test() { SSL2ClientMasterKeySerializer serializer = new SSL2ClientMasterKeySerializer(this.message, this.version); byte[] result = serializer.serializeProtocolMessageContent(); assertArrayEquals(this.expectedClientMasterKeyMessage, result); }