SrtpExtensionParser extends ExtensionParser<SrtpExtensionMessage> { @Override public void parseExtensionMessageContent(SrtpExtensionMessage msg) { msg.setSrtpProtectionProfilesLength(parseIntField(ExtensionByteLength.SRTP_PROTECTION_PROFILES_LENGTH)); LOGGER.debug("Parsed the srtp protection profiles length of " + msg.getSrtpProtectionProfilesLength().getValue()); msg.setSrtpProtectionProfiles(parseByteArrayField(msg.getSrtpProtectionProfilesLength().getValue())); LOGGER.debug("Parsed the srtp protection profiles " + ArrayConverter.bytesToHexString(msg.getSrtpProtectionProfiles())); msg.setSrtpMkiLength(parseIntField(ExtensionByteLength.SRTP_MASTER_KEY_IDENTIFIER_LENGTH)); LOGGER.debug("Parsed the srtp mki length of " + msg.getSrtpMkiLength().getValue()); if (msg.getSrtpMkiLength().getValue() != 0) { msg.setSrtpMki(parseByteArrayField(msg.getSrtpMkiLength().getValue())); LOGGER.debug("Parsed the srtp mki " + ArrayConverter.bytesToHexString(msg.getSrtpMki())); } else { LOGGER.debug("Parsed no srtp mki"); msg.setSrtpMki(new byte[0]); } } SrtpExtensionParser(int startposition, byte[] array); @Override void parseExtensionMessageContent(SrtpExtensionMessage msg);  }
@Test public void testParseExtensionMessageContent() { SrtpExtensionMessage msg = parser.parse(); assertArrayEquals(extensionType.getValue(), msg.getExtensionType().getValue()); assertEquals(extensionLength, (long) msg.getExtensionLength().getValue()); assertArrayEquals(srtpProtectionProfiles, msg.getSrtpProtectionProfiles().getValue()); assertEquals(srtpProtectionProfilesLength, (long) msg.getSrtpProtectionProfilesLength().getValue()); assertEquals(srtpMkiLength, (long) msg.getSrtpMkiLength().getValue()); assertArrayEquals(srtpMki, msg.getSrtpMki().getValue()); }