@Override public void writeData(ObjectDataOutput out) throws IOException { out.writeInt(port); out.write(type); if (host != null) { byte[] address = stringToBytes(host); out.writeInt(address.length); out.write(address); } else { out.writeInt(0); } }