public static void disconnectFromDS() {
    GemFireCacheImpl.testCacheXml = null;

    for (;;) {
      DistributedSystem ds = InternalDistributedSystem.getConnectedInstance();
      if (ds == null) {
        break;
      }
      try {
        ds.disconnect();
      } catch (Exception ignore) {
      }
    }

    AdminDistributedSystemImpl ads = AdminDistributedSystemImpl.getConnectedInstance();
    if (ads != null) {
      ads.disconnect();
    }
    if (Locator.hasLocator()) {
      Locator.getLocator().stop();
    }
  }
Disconnects this VM from the distributed system
geode-dunit/src/main/java/org/apache/geode/test/dunit/Disconnect.java