### Question:
QueryRunner implements Closeable { public Query startQuery(String query) { return new Query(startInternalQuery(session.get(), query), debug); } QueryRunner(
            ClientSession session,
            boolean debug,
            Optional<HostAndPort> socksProxy,
            Optional<HostAndPort> httpProxy,
            Optional<String> keystorePath,
            Optional<String> keystorePassword,
            Optional<String> keystoreType,
            Optional<String> truststorePath,
            Optional<String> truststorePassword,
            Optional<String> truststoreType,
            boolean insecureSsl,
            Optional<String> accessToken,
            Optional<String> user,
            Optional<String> password,
            Optional<String> kerberosPrincipal,
            Optional<String> krb5ServicePrincipalPattern,
            Optional<String> kerberosRemoteServiceName,
            Optional<String> kerberosConfigPath,
            Optional<String> kerberosKeytabPath,
            Optional<String> kerberosCredentialCachePath,
            boolean kerberosUseCanonicalHostname); ClientSession getSession(); void setSession(ClientSession session); boolean isDebug(); Query startQuery(String query); StatementClient startInternalQuery(String query); @Override void close();  }### Answer:
@Test public void testCookie() throws Exception { server.enqueue(new MockResponse() .setResponseCode(307) .addHeader(LOCATION, server.url("/v1/statement")) .addHeader(SET_COOKIE, "a=apple")); server.enqueue(new MockResponse() .addHeader(CONTENT_TYPE, "application/json") .setBody(createResults(server))); server.enqueue(new MockResponse() .addHeader(CONTENT_TYPE, "application/json") .setBody(createResults(server))); QueryRunner queryRunner = createQueryRunner(createClientSession(server), false); try (Terminal terminal = terminal()) { try (Query query = queryRunner.startQuery("first query will introduce a cookie")) { query.renderOutput(terminal, nullPrintStream(), nullPrintStream(), CSV, false, false); } try (Query query = queryRunner.startQuery("second query should carry the cookie")) { query.renderOutput(terminal, nullPrintStream(), nullPrintStream(), CSV, false, false); } } assertNull(server.takeRequest().getHeader("Cookie")); assertEquals(server.takeRequest().getHeader("Cookie"), "a=apple"); assertEquals(server.takeRequest().getHeader("Cookie"), "a=apple"); }