@Test
  public void stops_afterInvokingRequestHandler_whenStopAfterRequest() throws Exception {
    // arrange
    requestHandler = mock(ControlRequestHandler.class);
    stopAfterRequest = true;
    ControlFileWatchdog watchdog =
        new ControlFileWatchdog(directory, requestFileName, requestHandler, stopAfterRequest);
    watchdog.start();

    // act
    File file = new EmptyFileWriter(requestFile).createNewFile();

    // assert
    verify(requestHandler, timeout(TEN_MINUTES_MILLIS)).handleRequest();
    await().untilAsserted(() -> assertThat(watchdog.isAlive()).isFalse());
    await().untilAsserted(() -> assertThat(file).doesNotExist());
  }
Functional integration tests for {@link ControlFileWatchdog}.
geode-core/src/integrationTest/java/org/apache/geode/internal/process/ControlFileWatchdogIntegrationTest.java