@Override
    public CompletableFuture<List<ResponseMessage>> submitAsync(final RequestMessage requestMessage) throws Exception {
        final List<ResponseMessage> results = new ArrayList<>();
        final CompletableFuture<List<ResponseMessage>> f = new CompletableFuture<>();
        callbackResponseHandler.callback = response -> {
            // message with trailers
            if (f.isDone())
                throw new RuntimeException("A terminating message was already encountered - no more messages should have been received");

            results.add(response);

            // check if the current message is terminating - if it is then we can mark complete
            if (Channelizer.HttpChannelizer.LAST_CONTENT_READ_RESPONSE == response) {
                f.complete(results);
            }
        };

        writeAndFlush(requestMessage);

        return f;
    }
A simple, non-thread safe Gremlin Server client using HTTP. Typical use is for testing and demonstration.
gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/SimpleHttpClient.java