public static Integer createServerCache() throws Exception {
    StatsBugDUnitTest test = new StatsBugDUnitTest();
    Properties props = new Properties();
    cache = test.createCache(props);
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setDataPolicy(DataPolicy.REPLICATE);

    RegionAttributes attrs = factory.create();

    cache.createRegion(REGION_NAME, attrs);
    CacheServer server = cache.addCacheServer();
    int port = getRandomAvailableTCPPort();
    server.setPort(port);
    server.setNotifyBySubscription(false);
    server.setSocketBufferSize(32768);
    server.start();
    LogWriterUtils.getLogWriter().info("Server started at PORT = " + port);
    return port;
  }
Creates and starts the cache-server

@return - the port on which cache-server is running
@throws Exception - thrown if any problem occurs in cache/server creation
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/StatsBugDUnitTest.java