@Test
public void testRoundRobinBackoffFailureRecovery()
    throws EventDeliveryException, InterruptedException {

  Channel ch = new MockChannel();
  int n = 100;
  int numEvents = 3 * n;
  for (int i = 0; i < numEvents; i++) {
    ch.put(new MockEvent("test" + i));
  }
  MockSink s1 = new MockSink(1);
  s1.setChannel(ch);
  MockSink s2 = new MockSink(2);
  s2.setChannel(ch);
  s2.setFail(true);
  MockSink s3 = new MockSink(3);
  s3.setChannel(ch);
  List<Sink> sinks = new ArrayList<Sink>();
  sinks.add(s1);
  sinks.add(s2);
  sinks.add(s3);
  LoadBalancingSinkProcessor lbsp = getProcessor("round_robin",sinks, true);
  Status s = Status.READY;
  for (int i = 0; i < 3 && s != Status.BACKOFF; i++) {
    s = lbsp.process();
  }
  s2.setFail(false);
  Thread.sleep(2001);
  while (s != Status.BACKOFF) {
    s = lbsp.process();
  }
  Assert.assertEquals(n + 1, s1.getEvents().size());
  Assert.assertEquals(n - 1,  s2.getEvents().size());
  Assert.assertEquals(n, s3.getEvents().size());
}