CachedInfoExtensionSerializer extends ExtensionSerializer<CachedInfoExtensionMessage> { @Override public byte[] serializeExtensionContent() { appendInt(msg.getCachedInfoLength().getValue(), ExtensionByteLength.CACHED_INFO_LENGTH); appendBytes(msg.getCachedInfoBytes().getValue()); return getAlreadySerialized(); } CachedInfoExtensionSerializer(CachedInfoExtensionMessage message); @Override byte[] serializeExtensionContent();  }
@Test public void testSerializeExtensionContent() { msg.setCachedInfo(cachedObjectList); msg.setExtensionType(type.getValue()); msg.setExtensionLength(extensionLength); msg.setCachedInfoLength(cachedInfoLength); CachedInfoExtensionPreparator preparator = new CachedInfoExtensionPreparator(new TlsContext().getChooser(), msg, new CachedInfoExtensionSerializer(msg)); preparator.prepare(); assertArrayEquals(extensionBytes, serializer.serialize()); }