@Test
  public void test_GatewaySender_Started_Before_Locator() {
    try {
      int port = AvailablePortHelper.getRandomAvailableTCPPort();
      vm0.invoke(() -> WANTestBase.createCache(port));
      vm0.invoke(
          () -> WANTestBase.createSender("ln", 2, false, 100, 10, false, false, null, false));
      fail("Expected GemFireConfigException but not thrown");
    } catch (Exception e) {
      if (!(e.getCause() instanceof GemFireConfigException)) {
        Assert.fail("Expected GemFireConfigException but received :", e);
      }
    }
  }
Test to validate that sender can not be started without locator started. else
GemFireConfigException will be thrown.
geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/misc/WanAutoDiscoveryDUnitTest.java