public ClientCache createServersAndClient(int numberOfServers) {
    int[] ports = new int[numberOfServers];
    Host host = Host.getHost(0);
    for (int i = 0; i < numberOfServers; i++) {
      VM vm = host.getVM(i);
      ports[i] = createServer(vm);
    }

    ClientCacheFactory clientCacheFactory = new ClientCacheFactory();
    Arrays.stream(ports).forEach(port -> {
      clientCacheFactory.addPoolServer("localhost", port);
    });
    configureClient(clientCacheFactory);
    return getClientCache(clientCacheFactory);
  }
Base class for function tests that use client server. This class takes care of setting up the
client server topology.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/FunctionServiceClientBase.java