private int create() throws IOException {
      assertThat(regionShortcut).isNotNull();

      Properties config = getDistributedSystemProperties();
      config.setProperty(LOCATORS, locators);

      createCache(new CacheFactory(config));

      // In this test, no cacheLoader should be defined, otherwise, it will create a value for
      // destroyed key

      RegionFactory<String, TickerData> regionFactory =
          getCache().createRegionFactory(regionShortcut);
      if (regionShortcut.isPartition()) {
        regionFactory.setPartitionAttributes(new PartitionAttributesFactory<>()
            .setRedundantCopies(redundantCopies)
            .setTotalNumBuckets(10)
            .create());
      }

      // create diskStore if required
      if (regionShortcut.isPersistent()) {
        DiskStore diskStore = getCache().findDiskStore(diskStoreName);
        if (diskStore == null) {
          getCache().createDiskStoreFactory()
              .setDiskDirs(getDiskDirs())
              .create(diskStoreName);
        }
        regionFactory.setDiskStoreName(diskStoreName);

      } else {
        // enable concurrency checks (not for disk now - disk doesn't support versions yet)
        regionFactory.setConcurrencyChecksEnabled(true);
      }

      regionFactory.create(regionName);

      CacheServer cacheServer = getCache().addCacheServer();
      cacheServer.setMaxThreads(0);
      cacheServer.setPort(0);
      cacheServer.start();
      return cacheServer.getPort();
    }
Stops the cache server specified by port
geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/PutAllClientServerDistributedTest.java