@Test
  public void testAttemptTimer() {
    ForeignExceptionListener listener1 = Mockito.mock(ForeignExceptionListener.class);
    ForeignExceptionListener listener2 = Mockito.mock(ForeignExceptionListener.class);
    ForeignExceptionDispatcher orchestrator = new ForeignExceptionDispatcher();

    // add the listeners
    orchestrator.addListener(listener1);
    orchestrator.addListener(listener2);

    // now create a timer and check for that error
    TimeoutExceptionInjector timer = new TimeoutExceptionInjector(orchestrator, 1000);
    timer.start();
    timer.trigger();
    // make sure that we got the timer error
    Mockito.verify(listener1, Mockito.times(1)).receive(Mockito.any());
    Mockito.verify(listener2, Mockito.times(1)).receive(Mockito.any());
  }
Test that the dispatcher can receive an error via the timer mechanism.
hbase-server/src/test/java/org/apache/hadoop/hbase/errorhandling/TestForeignExceptionDispatcher.java