java - Netty 4.0 IdleStateHandler not working correctly -
edit: works correctly. problem entirely on side. can used working example.
i'm trying implement idlestatehandler netty 4.0.9 in server. problem i'm getting doesn't fire idlestateevent.
to test i'm making client "crash" did oio (and worked intended in case).
i'm sure have no blocking anywhere, works fine (including normal closing connection request client).
here code... pipeline
public pipelineinitializer(){ super(); } @override protected void initchannel(socketchannel ch) throws exception { // idle handlers ch.pipeline().addlast("idlechecker", new idlestatehandler(15,0,0)); ch.pipeline().addlast("idledisconnecter", new idledisconnecter()); // decoding handlers ch.pipeline().addlast("framer", new delimiterbasedframedecoder(integer.max_value, delimiters.linedelimiter())); ch.pipeline().addlast("decoder", str_decoder); // encoding handlers ch.pipeline().addlast("encoder", str_encoder); // processing handlers (if idle event, disconnects) ch.pipeline().addlast("serviceselector", new serviceselector()); }
and handler supposed handle idleevent:
public class idledisconnecter extends channelduplexhandler { public idledisconnecter(){ super(); } @override public void usereventtriggered(channelhandlercontext ctx, object evt) throws exception{ system.out.println("event fired"); // doesn't trigger if (evt instanceof idlestateevent) { system.out.println("event idlestateevent"); // doesn't trigger if (((idlestateevent) evt).state() == idlestate.reader_idle) { system.out.println("event reader one"); // doesn't trigger throw new exception(); //i want catch last handler in pipeline } } }
any suggest? i've made stupid error refuse see, don't know, i'm out of ideas.
thank you
Comments
Post a Comment