SrtpExtensionSerializer extends ExtensionSerializer<SrtpExtensionMessage> { @Override public byte[] serializeExtensionContent() { appendInt(msg.getSrtpProtectionProfilesLength().getValue(), ExtensionByteLength.SRTP_PROTECTION_PROFILES_LENGTH); appendBytes(msg.getSrtpProtectionProfiles().getValue()); appendInt(msg.getSrtpMkiLength().getValue(), ExtensionByteLength.SRTP_MASTER_KEY_IDENTIFIER_LENGTH); if (msg.getSrtpMkiLength().getValue() != 0) { appendBytes(msg.getSrtpMki().getValue()); } return getAlreadySerialized(); } SrtpExtensionSerializer(SrtpExtensionMessage message); @Override byte[] serializeExtensionContent();  }
@Test public void testSerializeExtensionContent() { msg.setExtensionType(extensionType.getValue()); msg.setExtensionLength(extensionLength); msg.setSrtpProtectionProfilesLength(srtpProtectionProfilesLength); msg.setSrtpProtectionProfiles(srtpProtectionProfiles); msg.setSrtpMkiLength(srtpMkiLength); msg.setSrtpMki(srtpMki); assertArrayEquals(expectedBytes, serializer.serialize()); }