public void encode(IoSession session, Object message,
ProtocolEncoderOutput out) throws Exception {
Class<?> type = message.getClass();
MessageEncoder encoder = findEncoder(type);
if (encoder == null) {
throw new ProtocolEncoderException("Unexpected message type: "
+ type);
}
encoder.encode(session, message, out);
}