@Override
    public void userEventTriggered(final ChannelHandlerContext ctx, final Object evt) {
        if (evt instanceof IdleStateEvent) {
            final IdleStateEvent e = (IdleStateEvent) evt;
            logger.info("Detected IdleStateEvent {} - closing channel {}", e, ctx.channel().id().asShortText());
            ctx.channel().attr(IDLE_STATE_EVENT).set(e);
            ctx.close();
        }
    }
Detects if an {@link IdleStateEvent} has occurred and closes the channel.
gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/IdleConnectionHandler.java