ServerCertificateTypeExtensionSerializer extends
        ExtensionSerializer<ServerCertificateTypeExtensionMessage> { @Override public byte[] serializeExtensionContent() { if (msg.getCertificateTypesLength() != null) { appendInt(msg.getCertificateTypesLength().getValue(), ExtensionByteLength.CERTIFICATE_TYPE_TYPE_LENGTH); } appendBytes(msg.getCertificateTypes().getValue()); return getAlreadySerialized(); } ServerCertificateTypeExtensionSerializer(ServerCertificateTypeExtensionMessage message); @Override byte[] serializeExtensionContent();  }
@Test public void testSerializeExtensionContent() { msg.setExtensionType(extensionType.getValue()); msg.setExtensionLength(extensionLength); msg.setCertificateTypes(CertificateType.toByteArray(certificateTypes)); if (certificateTypesLength != null) { msg.setCertificateTypesLength(certificateTypesLength); } else { assertNull(certificateTypesLength); } msg.setIsClientMessage(isClientState); assertArrayEquals(expectedBytes, serializer.serialize()); }