java - messageReceived not called -
i've created class called messagehandler:
@override public void initchannel(socketchannel ch) throws exception { ch.pipeline().addlast( new logginghandler(loglevel.info), new gameserverhandler()); ch.pipeline().addlast("protobufhandler", new messagehandler()); }
also, added messagereceiver function, can't override documentation says because gives me error:
public class messagehandler extends simplechannelinboundhandler<object> { // @override public void messagereceived(channelhandlercontext ctx, object msg) { system.out.println(msg); // super.messagereceived(ctx, msg); } @override public void exceptioncaught(channelhandlercontext ctx, throwable cause) { cause.printstacktrace(); ctx.close(); } @override protected void channelread0(channelhandlercontext arg0, object arg1) throws exception { // todo auto-generated method stub } }
but messagereceived function never called:
info: [id: 0xbb603bfd, /127.0.0.1:54206 => /127.0.0.1:5000] active oct 07, 2014 10:48:49 pm io.netty.handler.logging.logginghandler logmessage info: [id: 0xbf711f5f, /127.0.0.1:54205 => /127.0.0.1:5000] received(383b) // message printed netty logger, not function.
i netty 4.x method need override , set system.out.println(...) stuff in channelread0(...). in netty 5 messagereceived(...).
java netty
No comments:
Post a Comment