ServerNamePairSerializier extends Serializer<ServerNamePair> { @Override protected byte[] serializeBytes() { LOGGER.debug("Serializing ServerNamePair"); writeServerNameType(pair); writeServerNameLength(pair); writeServerName(pair); return getAlreadySerialized(); } ServerNamePairSerializier(ServerNamePair pair);   }
@Test public void testSerializeBytes() { pair = new ServerNamePair(); pair.setServerNameLength(123); pair.setServerNameType((byte) 3); pair.setServerName(new byte[] { 1, 2, 3, 4, }); serializer = new ServerNamePairSerializier(pair); byte[] result = serializer.serialize(); assertArrayEquals(ArrayConverter.hexStringToByteArray("03007B01020304"), result); }