@Before public void startServer() { LOG.debug("Starting server for catching authorization code..."); server = new MockHtppServer(8083) { protected MockHandler createHandler(Server server) { return new MockHandler(server) { @Override public void handle( String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (request.getRequestURI().contains("favicon")) { LOG.debug("ignoring favicon-request."); return; } LOG.debug("Request to mock http server: {}", request); response.setStatus(200); } }; } }; server.startServer(); }
@After public void stopServer() { LOG.debug("Stopping server..."); server.stopServer(); }