CollectorServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (!httpAuth.isAllowed(req, resp)) { return; } I18N.bindLocale(req.getLocale()); try { addCollectorApplication(req, resp); } catch (final Exception e) { LOGGER.warn(e.toString(), e); final String userAgent = req.getHeader("User-Agent"); if (userAgent != null && userAgent.startsWith("Java")) { resp.sendError(HttpServletResponse.SC_PRECONDITION_FAILED, e.toString()); } else { final CollectorController collectorController = new CollectorController( collectorServer); final String application = collectorController.getApplication(req, resp); collectorController.writeMessage(req, resp, application, e.toString()); } } finally { I18N.unbindLocale(); } }  @Override void init(ServletConfig config); @Override void destroy(); static void addCollectorApplication(String application, String urls); static void removeCollectorApplication(String application);  }
@Test public void testDoPost() throws ServletException, IOException { final List<String> nullUrl = Arrays.asList((String) null); doPost(null, nullUrl, false); doPost(null, nullUrl, true); doPost(TEST, nullUrl, true); doPost(TEST, Arrays.asList("http: true); doPost(TEST, Arrays.asList("https: true); doPost(TEST, Arrays.asList("ftp: doPost(TEST, Arrays.asList("http: }