@Test
    public void shouldAuthorizeStringRequest() throws Exception {
        final Cluster cluster = TestClientFactory.build().auth(basic("marko", "rainbow-dash")).create();
        final Client client = cluster.connect();

        RequestOptions modern = RequestOptions.build().addG("gmodern").create();
        RequestOptions classic = RequestOptions.build().addG("gclassic").create();

        try {
            assertEquals(2, client.submit("g.inject(2)").all().get().get(0).getInt());
            assertEquals(6, client.submit("g.V().count()", classic).all().get().get(0).getInt());
            assertEquals(6, client.submit("g.V().values('name').count()", modern).all().get().get(0).getInt());
        } finally {
            cluster.close();
        }
    }
Configure Gremlin Server settings per test.
gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthzIntegrateTest.java