RSAClientKeyExchangeSerializer extends
        ClientKeyExchangeSerializer<T> { @Override public byte[] serializeHandshakeMessageContent() { LOGGER.debug("Serializing RSAClientKeyExchangeMessage"); if (!version.isSSL()) { writeSerializedPublicKeyLength(msg); } writeSerializedPublickey(msg); return getAlreadySerialized(); } RSAClientKeyExchangeSerializer(T message, ProtocolVersion version); @Override byte[] serializeHandshakeMessageContent();  }
@Test public void testSerializeHandshakeMessageContent() { RSAClientKeyExchangeMessage msg = new RSAClientKeyExchangeMessage(); msg.setCompleteResultingMessage(expectedPart); msg.setType(type.getValue()); msg.setLength(length); msg.setPublicKey(serializedKey); msg.setPublicKeyLength(serializedKeyLength); RSAClientKeyExchangeSerializer serializer = new RSAClientKeyExchangeSerializer(msg, version); assertArrayEquals(expectedPart, serializer.serialize()); }