@Test
  public void usesPortSpecifiedByServerLauncherParametersWithPort() {
    ServerLauncherParameters.INSTANCE.withPort(AvailablePortHelper.getRandomAvailableTCPPort())
        .withDisableDefaultServer(true);
    Cache cache = getCache();

    AtomicBoolean membershipFailed = new AtomicBoolean();
    MembershipManagerHelper.addTestHook(cache.getDistributedSystem(), new MembershipTestHook() {
      @Override
      public void beforeMembershipFailure(String reason, Throwable cause) {
        membershipFailed.set(true);
      }
    });
    MembershipManagerHelper.crashDistributedSystem(cache.getDistributedSystem());
    await().until(membershipFailed::get);
    await()
        .until(() -> cache.getReconnectedCache() != null);

    Cache newCache = cache.getReconnectedCache();
    system = (InternalDistributedSystem) cache.getDistributedSystem();
    CacheServer server = newCache.getCacheServers().iterator().next();
    assertEquals(ServerLauncherParameters.INSTANCE.getPort().intValue(), server.getPort());
    assertEquals(20, server.getMaxConnections()); // this setting is in the XML file
  }
This test exercises auto-reconnect functionality when there is a cache-server that was started by
gfsh but was configured both by gfsh and a cache.xml file. The JIRA ticket for this is
GEODE-2732.
geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectWithCacheXMLDUnitTest.java