EmbeddedPiranha implements Piranha { public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws IOException, ServletException { if (servletRequest.getServletContext() == null && servletRequest instanceof EmbeddedRequest) { EmbeddedRequest embeddedRequest = (EmbeddedRequest) servletRequest; embeddedRequest.setWebApplication(webApplication); } if (servletResponse instanceof EmbeddedResponse) { EmbeddedResponse embeddedResponse = (EmbeddedResponse) servletResponse; embeddedResponse.setWebApplication(webApplication); } webApplication.linkRequestAndResponse(servletRequest, servletResponse); webApplication.service(servletRequest, servletResponse); webApplication.unlinkRequestAndResponse(servletRequest, servletResponse); } EmbeddedPiranha(); EmbeddedPiranha destroy(); @Override String getVersion(); WebApplication getWebApplication(); EmbeddedPiranha initialize(); void service(ServletRequest servletRequest, ServletResponse servletResponse); EmbeddedPiranha start(); EmbeddedPiranha stop();  }
@Test void testService() throws Exception { EmbeddedRequest request = new EmbeddedRequest(); EmbeddedResponse response = new EmbeddedResponse(); EmbeddedPiranha piranha = new EmbeddedPiranha(); piranha.initialize(); piranha.start(); piranha.service(request, response); piranha.stop(); }