AlpnExtensionParser extends ExtensionParser<AlpnExtensionMessage> { @Override public void parseExtensionMessageContent(AlpnExtensionMessage msg) { msg.setAlpnExtensionLength(parseIntField(ExtensionByteLength.ALPN_EXTENSION_LENGTH)); byte[] anouncedProtocols = parseByteArrayField(msg.getAlpnExtensionLength().getValue()); msg.setAlpnAnnouncedProtocols(anouncedProtocols); List<AlpnEntry> entryList = new LinkedList<>(); int pointer = 0; while (pointer < anouncedProtocols.length) { AlpnEntryParser parser = new AlpnEntryParser(pointer, anouncedProtocols); entryList.add(parser.parse()); pointer = parser.getPointer(); } msg.setAlpnEntryList(entryList); } AlpnExtensionParser(int startposition, byte[] array); @Override void parseExtensionMessageContent(AlpnExtensionMessage msg);  }
@Test public void testParseExtensionMessageContent() { message = parser.parse(); assertArrayEquals(extensionType.getValue(), message.getExtensionType().getValue()); assertEquals(extensionLength, (long) message.getExtensionLength().getValue()); assertEquals(alpnExtensionLength, (long) message.getAlpnExtensionLength().getValue()); assertArrayEquals(alpnAnnouncedProtocols, message.getAlpnAnnouncedProtocols().getValue()); }