SupportedVersionsExtensionSerializer extends ExtensionSerializer<SupportedVersionsExtensionMessage> { @Override public byte[] serializeExtensionContent() { LOGGER.debug("Serializing SupportedVersionsExtensionMessage"); if (msg.getSupportedVersionsLength() == null || msg.getSupportedVersions().getValue() == null) { writeSupportedVersions(msg); } else { writeSupportedVersionsLength(msg); writeSupportedVersions(msg); } return getAlreadySerialized(); } SupportedVersionsExtensionSerializer(SupportedVersionsExtensionMessage message); @Override byte[] serializeExtensionContent();  }
@Test public void testSerializeExtensionContent() { SupportedVersionsExtensionMessage msg = new SupportedVersionsExtensionMessage(); msg.setExtensionType(type.getValue()); msg.setExtensionLength(extensionLength); msg.setSupportedVersions(versionList); msg.setSupportedVersionsLength(versionListLength); SupportedVersionsExtensionSerializer serializer = new SupportedVersionsExtensionSerializer(msg); assertArrayEquals(completeExtension, serializer.serialize()); }