@Test
public void testFailOverSink() throws IOException, InterruptedException {

  CounterSink primary = new CounterSink("primary");
  CounterSink secondary = new CounterSink("backup");
  IntervalFlakeyEventSink<EventSink> flake = new IntervalFlakeyEventSink<EventSink>(
      primary, 2);
  FailOverSink failsink = new FailOverSink(flake, secondary);
  failsink.open();
  for (int i = 0; i < 100; i++) {
    Event e = new EventImpl(("event " + i).getBytes());
    failsink.append(e);
  }
  // this should succeed, with the counts being equal in primary and
  // secondary.
  failsink.close();
  Assert.assertEquals(primary.getCount(), secondary.getCount());
}