@Override
    public void channelIdle(NioChannel channel, IdleState state) {
        if (state == null) {
            return;
        }
        com.github.ltsopensource.remoting.Channel ch = new LtsChannel(channel);

        final String remoteAddress = RemotingHelper.parseChannelRemoteAddr(ch);

        if (BOTH_IDLE == state) {
            LOGGER.info("{}: IDLE [{}]", sideType, remoteAddress);
            RemotingHelper.closeChannel(ch);
        }

        if (remoting.getChannelEventListener() != null) {
            RemotingEventType remotingEventType = null;
            switch (state) {
                case BOTH_IDLE:
                    remotingEventType = RemotingEventType.ALL_IDLE;
                    break;
                case READER_IDLE:
                    remotingEventType = RemotingEventType.READER_IDLE;
                    break;
                case WRITER_IDLE:
                    remotingEventType = RemotingEventType.WRITER_IDLE;
                    break;
            }
            remoting.putRemotingEvent(new RemotingEvent(remotingEventType, remoteAddress, ch));
        }
    }
@author Robert HG (254963746@qq.com) on 2/8/16.
lts-core/src/main/java/com/github/ltsopensource/remoting/lts/LtsEventHandler.java