DefaultWebApplicationServer implements HttpServerProcessor, WebApplicationServer { @Override public boolean process(HttpServerRequest request, HttpServerResponse response) { try { DefaultWebApplicationServerRequest serverRequest = (DefaultWebApplicationServerRequest) createRequest(request); DefaultWebApplicationServerResponse serverResponse = (DefaultWebApplicationServerResponse) createResponse(response); service(serverRequest, serverResponse); return serverRequest.isAsyncStarted(); } catch (Exception exception) { exception.printStackTrace(System.err); } return false; } DefaultWebApplicationServer(); void addMapping(String servletContextName, String contextPath); @Override void addWebApplication(WebApplication webApplication); WebApplicationServerResponse createResponse(HttpServerResponse httpResponse); @Override WebApplicationServerRequestMapper getRequestMapper(); @Override void initialize(); @Override boolean process(HttpServerRequest request, HttpServerResponse response); @Override void service(WebApplicationServerRequest request, WebApplicationServerResponse response); @Override void setRequestMapper(WebApplicationServerRequestMapper requestMapper); @Override void start(); @Override void stop();  }
@Test void testProcess() throws Exception { DefaultWebApplicationServer server = new DefaultWebApplicationServer(); HttpServer httpServer = new DefaultHttpServer(8180, server, false); DefaultWebApplication application = new DefaultWebApplication(); application.setContextPath("/context"); application.addServlet("snoop", new TestSnoopServlet()); application.addServletMapping("snoop", "/snoop/*"); server.addWebApplication(application); server.initialize(); server.start(); httpServer.start(); try { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder(new URI("http: HttpResponse<Void> response = client.send(request, HttpResponse.BodyHandlers.discarding()); assertEquals(200, response.statusCode()); } catch (IOException ioe) { throw new RuntimeException(ioe); } httpServer.stop(); server.stop(); }