KeyShareExtensionSerializer extends ExtensionSerializer<KeyShareExtensionMessage> { @Override public byte[] serializeExtensionContent() { LOGGER.debug("Serializing KeyShareExtensionMessage"); if (connection == ConnectionEndType.CLIENT) { writeKeyShareListLength(msg); } writeKeyShareListBytes(msg); return getAlreadySerialized(); } KeyShareExtensionSerializer(KeyShareExtensionMessage message, ConnectionEndType connection); @Override byte[] serializeExtensionContent();  }
@Test public void testSerializeExtensionContent() { KeyShareExtensionMessage msg = new KeyShareExtensionMessage(); msg.setExtensionType(type.getValue()); msg.setExtensionLength(extensionLength); msg.setKeyShareListBytes(keyShareList); msg.setKeyShareListLength(keyShareListLength); KeyShareExtensionSerializer serializer = new KeyShareExtensionSerializer(msg, ConnectionEndType.CLIENT); assertArrayEquals(completeExtension, serializer.serialize()); }