private void preStart() throws IOException {
        if (withES) {
            if (node == null) {
                node = EsTestUtil.provideElasticsearchContainer();
            }
            if (!node.isRunning()) {
                // We have to start the test container here manually but it is stopped automatically from the test container library
                // For performance reasons we do not stop the elasticsearch container between test runs
                node.start();
            }

            System.out.println("================ STARTED ES ================ ");

            RestClientBuilder clientBuilder = RestClient.builder(
                    new HttpHost(node.getContainerIpAddress(), node.getFirstMappedPort(), "http")
            );
            clientBuilder.setRequestConfigCallback(builder -> builder.setConnectTimeout(ES_CLIENT_TIMEOUT)
                    .setSocketTimeout(ES_CLIENT_TIMEOUT));

            ES_CLIENT = new RestHighLevelClient(clientBuilder);
        }

        if (withDB) {
            TestUtil.setProperty("apiman-gateway", DB_JNDI_LOC);
            try {
                InitialContext ctx = TestUtil.initialContext();
                TestUtil.ensureCtx(ctx, "java:/comp/env");
                TestUtil.ensureCtx(ctx, "java:/comp/env/jdbc");
                ds = createInMemoryDatasource();
                try {
                    ctx.bind(DB_JNDI_LOC, ds);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                System.out.println("DataSource created and bound to JNDI: " + DB_JNDI_LOC);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }

        if (withISPN) {
            cacheContainer = new DefaultCacheManager();
            Cache<Object, Object> registryCache = cacheContainer.getCache("registry");
            if (registryCache == null) {
                throw new RuntimeException("Error with ISPN cache: 'registry'");
            }
            try {
                InitialContext ctx = TestUtil.initialContext();
                TestUtil.ensureCtx(ctx, "java:jboss");
                TestUtil.ensureCtx(ctx, "java:jboss/infinispan");
                ctx.bind(ISPN_JNDI_LOC, cacheContainer);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
Does some configuration before starting the server.
@throws IOException
gateway/test/src/test/java/io/apiman/gateway/test/junit/servlet/ServletGatewayTestServer.java