AdaptrisMessageWorkerImp implements AdaptrisMessageWorker { @Override public void handleConnectionException() throws CoreException { if (hasActiveErrorHandler()) { Thread thread = new ManagedThreadFactory(getClass().getSimpleName()).newThread(new Runnable() { @Override public void run() { retrieveConnection(AdaptrisConnection.class).connectionErrorHandler().handleConnectionException(); } }); thread.setName("Connection Exc: " + Thread.currentThread().getName()); log.trace("Handling Connection Exception"); thread.start(); } } AdaptrisMessageWorkerImp(); @Override void handleConnectionException(); @Override String createName(); @Override String createQualifier(); @Override byte[] encode(AdaptrisMessage msg); @Override AdaptrisMessage decode(byte[] bytes); @Override AdaptrisMessageEncoder getEncoder(); @Override void setEncoder(AdaptrisMessageEncoder enc); @Override T retrieveConnection(Class<T> type); @Override void registerConnection(AdaptrisConnection conn); @Override String getUniqueId(); void setUniqueId(String s); Boolean getIsTrackingEndpoint(); @Override boolean isTrackingEndpoint(); void setIsTrackingEndpoint(Boolean b); @Override AdaptrisMessageFactory getMessageFactory(); @Override void setMessageFactory(AdaptrisMessageFactory f); T withMessageFactory(AdaptrisMessageFactory f); T withUniqueID(String uid);  }
@Test public void testHandleConnectionException() throws Exception { MockMessageProducer worker = new MockMessageProducer(); NullConnection conn = new NullConnection(); StandaloneProducer p = new StandaloneProducer(conn, worker); start(p); try { worker.handleConnectionException(); stop(p); conn.setConnectionErrorHandler(new NullConnectionErrorHandler()); start(p); worker.handleConnectionException(); } finally { stop(p); } }