@Test
    public void shouldHandleErrorsNotInFirstChunkPOSTWithChunkedResponseUsingTextPlain() throws Exception {
        final CloseableHttpClient httpclient = HttpClients.createDefault();
        final HttpPost httppost = new HttpPost(TestClientFactory.createURLString());
        httppost.addHeader(HttpHeaders.CONTENT_TYPE, "application/json");
        httppost.addHeader(HttpHeaders.ACCEPT, "text/plain");
        httppost.setEntity(new StringEntity("{\"gremlin\":\"g.inject(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17).coalesce(is(lt(17)),fail('some error'))\"}", Consts.UTF_8));

        try (final CloseableHttpResponse response = httpclient.execute(httppost)) {
            assertEquals(200, response.getStatusLine().getStatusCode());
            assertTrue(response.getEntity().isChunked());

            String textPlainResponse = EntityUtils.toString(response.getEntity());
            assertTrue(textPlainResponse.startsWith("==>0"));
            assertTrue(textPlainResponse.contains("==>5"));
            assertTrue(textPlainResponse.contains("==>15"));
            assertTrue(textPlainResponse.endsWith(System.lineSeparator() + "some error"));
        }
    }
Configure specific Gremlin Server settings for specific tests.
gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java