// Encode as ascii
try {
OutputStream outputStream = new EncodedStream.EncodedOutput(target);
FlushableEncoder encoder = new OutputStreamBackedEncoder(outputStream);
encoder.writeNullableString(pid == null ? null : pid.toString());
encoder.writeString(uid);
MultiChoiceAddress multiChoiceAddress = (MultiChoiceAddress) address;
UUID canonicalAddress = (UUID) multiChoiceAddress.getCanonicalAddress();
encoder.writeLong(canonicalAddress.getMostSignificantBits());
encoder.writeLong(canonicalAddress.getLeastSignificantBits());
encoder.writeInt(multiChoiceAddress.getPort());