private int setupJettyServer() throws Exception {
// Loop until Jetty binds to an available port
for (int httpPort = MIN_DYNAMIC_PORT; httpPort <= MAX_PORT_NUMBER; httpPort++) {
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
HttpServlet testServlet = new TestServlet();
context.addServlet(new ServletHolder(testServlet), "/*");
jettyServer = new Server(new InetSocketAddress(HTTP_HOST, httpPort));
jettyServer.setHandler(context);
try {
jettyServer.start();