@Test
    public void shouldInterceptRequestsWithHandshake() throws Exception {
        final int requestsToMake = 32;
        final AtomicInteger handshakeRequests = new AtomicInteger(0);

        final Cluster cluster = TestClientFactory.build().
                maxConnectionPoolSize(1).
                addInterceptor("counter", r -> {
                    handshakeRequests.incrementAndGet();
                    return r;
                }).create();

        try {
            final Client client = cluster.connect();
            for (int ix = 0; ix < requestsToMake; ix++) {
                final List<Result> result = client.submit(String.format("g.inject(%d)", ix+1)).all().get();
                assertEquals(ix + 1, result.get(0).getInt());
            }
        } finally {
            cluster.close();
        }

        assertEquals(requestsToMake, handshakeRequests.get());
    }
Configure specific Gremlin Server settings for specific tests.
gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java