ServerNamePairParser extends Parser<ServerNamePair> { @Override public ServerNamePair parse() { pair = new ServerNamePair(); parseServerNameType(pair); parseServerNameLength(pair); parseServerName(pair); pair.setServerNameConfig(pair.getServerName().getValue()); pair.setServerNameTypeConfig(pair.getServerNameType().getValue()); return pair; } ServerNamePairParser(int startposition, byte[] array); @Override ServerNamePair parse();  }
@Test public void testParse() { ServerNamePairParser parser = new ServerNamePairParser(0, servernamePairBytes); ServerNamePair pair = parser.parse(); assertArrayEquals(serverName, pair.getServerName().getValue()); assertTrue(serverNameLength == pair.getServerNameLength().getValue()); assertTrue(serverType == pair.getServerNameType().getValue()); }