private void setupGemFireCacheServer() {


    gemfireServerVm = VM.getVM(0);
    serverPort.set(AvailablePortHelper.getRandomAvailableTCPPort());

    gemfireServerVm.invoke(() -> {
      try {
        Cache cache = new CacheFactory()
            .set("name", "ClientServerRegisterInterestsTestGemFireServer").set(MCAST_PORT, "0")
            .set(LOG_FILE, "clientServerRegisterInterestsTest.log").set(LOG_LEVEL, "config")
            .create();

        RegionFactory<String, String> regionFactory = cache.createRegionFactory();

        regionFactory.setDataPolicy(DataPolicy.REPLICATE);
        regionFactory.setKeyConstraint(String.class);
        regionFactory.setValueConstraint(String.class);

        Region<String, String> example = regionFactory.create("Example");

        assertThat(example)
            .describedAs("The 'Example' Region was not properly configured and initialized!")
            .isNotNull();
        assertThat(example.getFullPath()).isEqualTo(SEPARATOR + "Example");
        assertThat(example.getName()).isEqualTo("Example");
        assertThat(example).isEmpty();

        example.put("1", "ONE");

        assertThat(example).isNotEmpty();
        assertThat(example).hasSize(1);

        CacheServer cacheServer = cache.addCacheServer();

        cacheServer.setPort(serverPort.get());
        cacheServer.setMaxConnections(10);

        ClientSubscriptionConfig clientSubscriptionConfig =
            cacheServer.getClientSubscriptionConfig();

        clientSubscriptionConfig.setCapacity(100);
        clientSubscriptionConfig.setEvictionPolicy("entry");

        cacheServer.start();

        assertThat(cacheServer.isRunning()).describedAs("Cache Server is not running!").isTrue();
      } catch (UnknownHostException e) {
        throw new RuntimeException(e);
      } catch (IOException e) {
        throw new RuntimeException(String.format(
            "Failed to start the GemFire Cache Server listening on port (%1$d) due to IO error!",
            serverPort.get()), e);
      }
    });
  }
The ClientServerRegisterInterestsDUnitTest class is a test suite of test cases testing the
interaction between a client and a server in a Register Interests scenario.

@since GemFire 8.0
geode-core/src/distributedTest/java/org/apache/geode/cache/client/ClientServerRegisterInterestsDUnitTest.java