ECDHEServerKeyExchangeSerializer extends
        ServerKeyExchangeSerializer<T> { @Override public byte[] serializeHandshakeMessageContent() { LOGGER.debug("Serializing ECDHEServerKeyExchangeMessage"); writeCurveType(msg); writeNamedGroup(msg); writeSerializedPublicKeyLength(msg); writeSerializedPublicKey(msg); if (isTLS12() || isDTLS12()) { writeSignatureAndHashAlgorithm(msg); } writeSignatureLength(msg); writeSignature(msg); return getAlreadySerialized(); } ECDHEServerKeyExchangeSerializer(T message, ProtocolVersion version); @Override byte[] serializeHandshakeMessageContent();  }
@Test public void testSerializeHandshakeMessageContent() { ECDHEServerKeyExchangeMessage msg = new ECDHEServerKeyExchangeMessage(); msg.setCompleteResultingMessage(expectedPart); msg.setCurveType(curveType); msg.setLength(length); msg.setType(type.getValue()); msg.setNamedGroup(namedGroup); msg.setPublicKey(pubKey); msg.setPublicKeyLength(pubKeyLength); if (signatureAndHashAlgo != null) { msg.setSignatureAndHashAlgorithm(signatureAndHashAlgo); } msg.setPublicKey(pubKey); msg.setPublicKeyLength(pubKeyLength); msg.setSignatureLength(sigLength); msg.setSignature(signature); ECDHEServerKeyExchangeSerializer serializer = new ECDHEServerKeyExchangeSerializer(msg, version); assertArrayEquals(expectedPart, serializer.serialize()); }