PaddingExtensionSerializer extends ExtensionSerializer<PaddingExtensionMessage> { @Override public byte[] serializeExtensionContent() { appendBytes(message.getPaddingBytes().getValue()); LOGGER.debug("Serialized PaddingExtension with " + message.getPaddingBytes().getValue().length + " padding bytes."); return getAlreadySerialized(); } PaddingExtensionSerializer(PaddingExtensionMessage message); @Override byte[] serializeExtensionContent();  }
@Test public void testSerializeExtensionContent() { message = new PaddingExtensionMessage(); message.setExtensionType(extensionType.getValue()); message.setExtensionLength(extensionLength); message.setPaddingBytes(extensionPayload); PaddingExtensionSerializer serializer = new PaddingExtensionSerializer(message); assertArrayEquals(expectedBytes, serializer.serialize()); }