message = amf3Input.readObject();74 return message;75 }76 }77 构建服务端PushProtocolHandler 1 public class PushProtocolHandler extends SimpleChannelHandler 2 { 3 public static Logger log = LoggerFactory 4 .getLogger(PushProtocolHandler.class); 5 /** 6 * 7 */ 8 @Override 9 public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)10 {11 if (e.getMessage() != null)12 {13 ChannelManager channelManager = PushServerContext14 .getBean(ChannelManager.class);15 if (e.getMessage() instanceof CommandMessage)16 {17 channelManager.handleMsg((CommandMessage) e.getMessage(), e18 .getChannel());19 }20 else if (e.getMessage() instanceof PushMessage)21 {22 channelManager.handleMsg((PushMessage) e.getMessage(), e23 .getChannel());24 }25 else26 {27 log.warn("unkown message {}", e);28 }29 }30 }31 }PushServerPipelineFactory 1 import static org.jboss.netty.channel.Channels.*; 2 /** 3 * 4 * @author sunwei 5 * @version 2010-7-22 6 * @since JDK1.5 7 */ 8 public class PushServerPipelineFactory implements ChannelPipelineFactory 9 {10 @Override11 public ChannelPipeline getPipeline() throws Exception12 {13 ChannelPipeline pipeline = pipeline();14 // 处理日志15 pipeline.addLast("logger", new LoggingHandler());16 // 处理coder17 pipeline.addLast("decoder", new AMF3Decoder(Constants.MAX_OBJECT_SIZE));18 pipeline.addLast("encoder", new AMF3Encoder());19 //20 pipeline.addLast("handler", new PushProtocolHandler());21 &