@Test
public void testSourceCounterChannelFail() throws Exception {

  init("true");
  ChannelProcessor cp = Mockito.mock(ChannelProcessor.class);
  doThrow(new ChannelException("dummy")).when(cp).processEvent(any(Event.class));
  source.setChannelProcessor(cp);
  doCounterCommon();
  for (int i = 0; i < 10 && source.getSourceCounter().getChannelWriteFail() == 0; i++) {
    Thread.sleep(100);
  }
  Assert.assertEquals(1, source.getSourceCounter().getChannelWriteFail());
}