JettyResponseService extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { StandardResponseProducer p = buildProducer(msg); try { LifecycleHelper.initAndStart(p, false); p.produce(msg); } catch (CoreException e) { throw ExceptionHelper.wrapServiceException(e); } finally { LifecycleHelper.stopAndClose(p, false); } } JettyResponseService();  JettyResponseService(int status, String contentType); @Override void doService(AdaptrisMessage msg); @Override void prepare(); String getHttpStatus(); void setHttpStatus(String s); JettyResponseService withHttpStatus(String status); String getContentType(); void setContentType(String ct); JettyResponseService withContentType(String type); ResponseHeaderProvider<HttpServletResponse> getResponseHeaderProvider(); void setResponseHeaderProvider(ResponseHeaderProvider<HttpServletResponse> provider); JettyResponseService withResponseHeaderProvider(ResponseHeaderProvider<HttpServletResponse> provider);  }
@Test public void testDoService() throws Exception { JettyResponseService responder = new JettyResponseService(200, "text/plain"); HttpConnection httpConnection = createConnection(); ServiceList list = new ServiceList(responder); Channel c = createChannel(httpConnection, createWorkflow(createConsumer(URL_TO_POST_TO), new MockMessageProducer(), list)); StandaloneRequestor requestor = createRequestor(httpConnection.getPort()); AdaptrisMessage msg = createMessage(); try { c.requestStart(); start(requestor); requestor.doService(msg); assertEquals(TEXT, msg.getContent()); assertFalse(msg.containsKey(CUSTOM_HEADER1)); assertFalse(msg.containsKey(CUSTOM_HEADER2)); } finally { c.requestClose(); stop(requestor); PortManager.release(httpConnection.getPort()); } }