case CHANNEL_MESSAGE:
ChannelIdentifier channelId = readChannelId();
Object payload = payloadReader.read();
return new ChannelMessage(channelId, payload);
case END_STREAM_MESSAGE:
return new EndOfStream();
default:
throw new IllegalArgumentException();
}
}