@Test
  public void testNoLocator() {
    String locators = hostName + "[" + port2 + "]";

    Properties props = getBasicProperties(locators);
    addDSProps(props);

    addIgnoredException(ConnectException.class);

    try {
      getConnectedDistributedSystem(props);
      fail("Should have thrown a GemFireConfigException");

    } catch (DistributionException ex) {
      // I guess it can throw this too...

    } catch (GemFireConfigException ex) {
      assertThat(ex.getCause().getMessage().contains("Could not contact any of the locators"))
          .isTrue();
    }
  }
Tests that attempting to connect to a distributed system in which no locator is defined throws
an exception.
geode-core/src/distributedTest/java/org/apache/geode/distributed/LocatorDUnitTest.java