//create a stream manager that will be capped to 100 Megabits
//remember that by default it is disabled!
streamManager = new StreamManager( 100 * BandwidthLimiter.OneMbps );
server = new Server();
HttpListener listener = new SocketListener(new InetAddrPort(getPort()));
server.addListener(listener);
HttpContext context = new HttpContext();
context.setContextPath("/");
server.addContext(context);
handler = new BrowserMobProxyHandler();
handler.setJettyServer(server);
handler.setShutdownLock(new Object());
client = new BrowserMobHttpClient(streamManager, requestCounter);
client.prepareForBrowser();
handler.setHttpClient(client);
context.addHandler(handler);
server.start();
setPort(listener.getPort());
}