TokenBindingExtensionSerializer extends ExtensionSerializer<TokenBindingExtensionMessage> { @Override public byte[] serializeExtensionContent() { appendBytes(message.getTokenbindingVersion().getValue()); appendInt(message.getParameterListLength().getValue(), 1); appendBytes(message.getTokenbindingKeyParameters().getValue()); return getAlreadySerialized(); } TokenBindingExtensionSerializer(TokenBindingExtensionMessage message); @Override byte[] serializeExtensionContent();  }
@Test public void testSerializeExtensionContent() { message = new TokenBindingExtensionMessage(); message.setExtensionType(extensionType.getValue()); message.setExtensionLength(extensionLength); message.setTokenbindingVersion(tokenbindingVersion.getByteValue()); message.setParameterListLength(parameterLength); message.setTokenbindingKeyParameters(keyParameter); TokenBindingExtensionSerializer serializer = new TokenBindingExtensionSerializer(message); assertArrayEquals(extensionBytes, serializer.serialize()); }