@Test
    public void shouldProvideBetterExceptionForMethodCodeTooLarge() {
        final int numberOfParameters = 6000;
        RequestOptions.Builder optionsBuilder = RequestOptions.build().language("gremlin-groovy");

        // generate a script with a ton of parameter usage to generate a "code too large" exception
        String script = "x = 0";
        for (int ix = 0; ix < numberOfParameters; ix++) {
            if (ix > 0 && ix % 100 == 0) {
                script = script + ";" + System.lineSeparator() + "x = x";
            }
            script = script + " + x" + ix;
            optionsBuilder.addParameter("x" + ix, ix);
        }

        final Cluster cluster = TestClientFactory.build().maxResponseContentLength(4096000).create();
        final Client client = cluster.connect();

        try {
            client.submit(script, optionsBuilder.create()).all().get();
            fail("Should have tanked out because of number of parameters used and size of the compile script");
        } catch (Exception ex) {
            assertThat(ex.getMessage(), containsString("The Gremlin statement that was submitted exceeds the maximum compilation size allowed by the JVM"));
        } finally {
            cluster.close();
        }
    }
Configure specific Gremlin Server settings for specific tests.
gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java