@Override
    public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
        // occurs when the server shuts down in a disorderly fashion, otherwise in an orderly shutdown the server
        // should fire off a close message which will properly release the driver.
        super.channelInactive(ctx);

        final ResultQueue current = pending.getAndSet(null);
        if (current != null) {
            current.markError(new IllegalStateException("Connection to server is no longer active"));
        }
    }
Takes a map of requests pending responses and writes responses to the {@link ResultQueue} of a request
as the {@link ResponseMessage} objects are deserialized.
gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java