CertificateMessageSerializer extends HandshakeMessageSerializer<CertificateMessage> { @Override public byte[] serializeHandshakeMessageContent() { LOGGER.debug("Serializing CertificateMessage"); if (version.isTLS13()) { writeRequestContextLength(msg); writeRequestContext(msg); } writeCertificatesListLength(msg); wirteCertificatesListBytes(msg); return getAlreadySerialized(); } CertificateMessageSerializer(CertificateMessage message, ProtocolVersion version); @Override byte[] serializeHandshakeMessageContent();  }
@Test public void testSerializeHandshakeMessageContent() { CertificateMessage message = new CertificateMessage(); message.setCertificatesListLength(certificatesLength); message.setCertificatesListBytes(certificateBytes); message.setLength(length); message.setType(type.getValue()); CertificateMessageSerializer serializer = new CertificateMessageSerializer(message, version); assertArrayEquals(expectedPart, serializer.serialize()); }