@Test
  public void testAfterConnectWithDifferentProperties() throws Exception {
    // Assert failure when a Distributed system exists but with different properties
    distSys = DistributedSystem.connect(createGemFireProperties()); // for teardown
    final Properties failed = new Properties();
    failed.put(MCAST_TTL, "64");

    try {
      new RegionFactory(failed);
      fail("Expected exception");
    } catch (IllegalStateException expected) {
      // passed
    }
  }
Test RegionFactory with Cache close and DistributedSystem disconnect
geode-core/src/integrationTest/java/org/apache/geode/cache/RegionFactoryJUnitTest.java