@ Override public void handleDownstream ( ChannelHandlerContext ctx , ChannelEvent evt ) throws Exception { if ( ! ( evt instanceof MessageEvent ) ) { ctx . sendDownstream ( evt ) ; return ; } final MessageEvent e = ( MessageEvent ) evt ; final Object originalMessage = e . getMessage ( ) ; final Object encodedMessage = encode ( ctx , e . getChannel ( ) , originalMessage ) ; if ( originalMessage == encodedMessage ) ctx . sendDownstream ( evt ) ; else if ( encodedMessage != null ) ctx . sendDownstream ( new DownstreamMessageEvent ( ctx . getChannel ( ) , e . getFuture ( ) , encodedMessage , e . getRemoteAddress ( ) ) ) ; // Channels.write(ctx, e.getFuture(), encodedMessage, e.getRemoteAddress()); }
Code copied from org . jboss . netty . handler . codec . oneone . OneToOneEncoder and org . jboss . netty . handler . codec . oneone . OneToOneDecoder