public static InternalLocator getLocator() {
    if (!(memberStarter instanceof LocatorStarterRule)) {
      throw new RuntimeException("no locator");
    }
    return ((LocatorStarterRule) memberStarter).getLocator();
  }
This is only available in each Locator/Server VM, not in the controller (test) VM.
geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/ClusterStartupRule.java