public Message createMessage(byte code, DataInput in)
throws IOException, UnknownMessageException {
switch (code) {
case CODE_OUT:
return new QueueMessage(in);
case CODE_INREPLY:
return new InReplyMessage(in);
default:
throw new UnknownMessageException("Unknown message code: "+code);
}