private DistributedMember waitForReconnect(VM vm) {
    return vm.invoke("wait for Reconnect and return ID", () -> {
      out.println("waitForReconnect invoked");
      final DistributedSystem ds = savedSystem;
      savedSystem = null;
      await().until(() -> ds.isReconnecting());
      long waitTime = 600;
      System.out.println("VM" + VM.getCurrentVMNum() + " waiting up to "
          + waitTime + " seconds for reconnect to complete");
      try {
        ds.waitUntilReconnected(waitTime, SECONDS);
      } catch (InterruptedException e) {
        fail("interrupted while waiting for reconnect");
      }
      assertThat(ds.getReconnectedSystem()).isNotNull();
      int oldViewId =
          getDistribution(ds).getLocalMember().getVmViewId();
      int newViewId =
          ((InternalDistributedMember) ds.getReconnectedSystem().getDistributedMember())
              .getVmViewId();
      if (!(newViewId > oldViewId)) {
        fail("expected a new ID to be assigned.  oldViewId=" + oldViewId + "; newViewId="
            + newViewId);
      }
      return ds.getReconnectedSystem().getDistributedMember();
    });
  }
this will throw an exception if location services aren't running
geode-core/src/distributedTest/java/org/apache/geode/cache30/ReconnectDUnitTest.java