EventSink fail4eva = mock(EventSink.Base.class);
doThrow(new IOException("mock exception")).when(fail4eva).open();
doReturn(new ReportEvent("stub")).when(fail4eva).getMetrics();
// max 5s, backoff initially at 10ms
BackoffPolicy bop = new CappedExponentialBackoff(10, 5000);
final InsistentOpenDecorator<EventSink> insistent = new InsistentOpenDecorator<EventSink>(
fail4eva, bop);
final StubbornAppendSink<EventSink> stubborn = new StubbornAppendSink<EventSink>(
insistent);
final InsistentAppendDecorator<EventSink> append = new InsistentAppendDecorator<EventSink>(
stubborn, new CappedExponentialBackoff(100, 100000));
final EventSink sink = new LazyOpenDecorator<EventSink>(append);
sink.open();
// create an endless stream of data
final EventSource source = new LazyOpenSource<EventSource>(