@Test
  public void testStartAfterTrigger() throws InterruptedException {
    final long time = 10;
    ForeignExceptionListener listener = mock(ForeignExceptionListener.class);
    TimeoutExceptionInjector timer = new TimeoutExceptionInjector(listener, time);
    timer.trigger();
    try {
      timer.start();
      fail("Timer should fail to start after complete.");
    } catch (IllegalStateException e) {
      LOG.debug("Correctly failed timer: " + e.getMessage());
    }
    Thread.sleep(time * 2);
    verify(listener, times(1)).receive(any());
    verifyNoMoreInteractions(listener);
  }
Demonstrate TimeoutExceptionInjector semantics -- triggering fires exception and completes the
timer.
hbase-server/src/test/java/org/apache/hadoop/hbase/errorhandling/TestTimeoutExceptionInjector.java