@Test
  public void testRestartLocator() throws Exception {
    File stateFile = new File("locator" + port1 + "state.dat");

    Properties properties = getBasicProperties(getHostName() + "[" + port1 + "]");
    properties.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
    properties.setProperty(LOG_LEVEL, DUnitLauncher.logLevel);
    addDSProps(properties);

    if (stateFile.exists()) {
      assertThat(stateFile.delete()).isTrue();
    }

    logger.info("Starting locator");
    Locator locator = Locator.startLocatorAndDS(port1, null, properties);
    system = (InternalDistributedSystem) locator.getDistributedSystem();

    vm0.invoke(() -> {
      getConnectedDistributedSystem(properties);
    });

    logger.info("Stopping locator");
    locator.stop();

    logger.info("Starting locator");
    locator = Locator.startLocatorAndDS(port1, null, properties);
    system = (InternalDistributedSystem) locator.getDistributedSystem();

    vm0.invoke("disconnect", () -> getConnectedDistributedSystem(properties).disconnect());
  }
Tests starting, stopping, and restarting a locator. See bug 32856.

@since GemFire 4.1
geode-core/src/distributedTest/java/org/apache/geode/distributed/LocatorDUnitTest.java