DefaultEventHandler extends EventHandlerBase { public void setProducer(AdaptrisMessageProducer p) { if (!retrieveComponentState().equals(ClosedState.getInstance())) { throw new IllegalStateException("Attempt to set the producer when already initialised"); } producer = Args.notNull(p, "producer"); } DefaultEventHandler();  DefaultEventHandler(AdaptrisMessageProducer producer);  DefaultEventHandler(AdaptrisConnection connection, AdaptrisMessageProducer producer); @Override AdaptrisMessageSender retrieveProducer(); void setConnection(AdaptrisConnection c); AdaptrisConnection getConnection(); void setProducer(AdaptrisMessageProducer p); AdaptrisMessageProducer getProducer(); @Override void prepare();  }
@Test public void testSendEventWithException() throws Exception { Event e = EventFactory.create(AdapterCloseEvent.class); DefaultEventHandler eh = applyConfiguration(newEventHandler("testSendEventWithException")); eh.setProducer(new FailFirstMockMessageProducer(2)); try { LifecycleHelper.initAndStart(eh); eh.send(e); eh.setLogAllExceptions(true); eh.send(e); } finally { eh.requestClose(); } doAssertions(eh, 0, e.getClass()); }