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

    Properties properties = getBasicProperties(getHostName() + "[" + port1 + "]");
    addDSProps(properties);

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

    Locator locator = Locator.startLocatorAndDS(port1, null, properties);
    system = (InternalDistributedSystem) locator.getDistributedSystem();

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

    locator.stop();
    locator = Locator.startLocatorAndDS(port1, null, properties);
    system = (InternalDistributedSystem) locator.getDistributedSystem();
    assertEquals(2, ((InternalDistributedSystem) locator.getDistributedSystem()).getDM()
        .getViewMembers().size());

    locator.stop();
    locator = Locator.startLocatorAndDS(port1, null, properties);
    system = (InternalDistributedSystem) locator.getDistributedSystem();
    assertEquals(2, ((InternalDistributedSystem) locator.getDistributedSystem()).getDM()
        .getViewMembers().size());
  }
a locator is restarted twice with a server and ends up in a split-brain
geode-core/src/distributedTest/java/org/apache/geode/distributed/LocatorDUnitTest.java