public Message newMessage(String type, String addr) {
/* Return the appropriate type of sub message. */
if (type == MessageConnection.TEXT_MESSAGE) {
return new TextObject(addr);
} else if (type == MessageConnection.BINARY_MESSAGE) {
return new BinaryObject(addr);
}
return null; /* message type not supported */
}