title: browsermob-proxy 'server is refusing connections' error
body: <p>Selenium Webdriver 2.42.2, browsermob-proxy Beta 9, Windows 7/Firefox</p>
  
  <p>I am trying to call the browsermob-proxy API to capture http network requests and after following this <a href="http://assertselenium.com/2012/11/02/performance-data-collection-using-browsermob-proxy-and-selenium/" rel="nofollow">example</a>. But, I get the following errors:</p>
  
  <pre><code>The proxy server is refusing connections
  </code></pre>
  
  <p>Firefox is configured to use a proxy server that is refusing connections.</p>
  
  <pre><code>Check the proxy settings to make sure that they are correct.
  Contact your network administrator to make sure the proxy server is working.
  </code></pre>
  
  <p>Anyone know if this could be a network issue, we do not use proxy servers in our network. I have also run the browsermob-proxy.bat -port 9090 to startup the server. Below is a sample of the code I've tried:</p>
  
  <pre><code>public void setDriver(String browser,String environment,String platform) throws Exception {
  ProxyServer server = null;
  
  // start the proxy
  server = new ProxyServer(9091);
  server.start();
  server.setCaptureHeaders(true);
  server.setCaptureContent(true);
  
  // set the Selenium proxy object
  Proxy proxy = server.seleniumProxy();
  //Proxy proxy = new Proxy();
  //proxy.setHttpProxy("localhost:9091");
  
  caps = DesiredCapabilities.firefox();
  caps.setCapability(CapabilityType.PROXY,proxy);
  
  server.newHar("test");
  
  public void closeDriver() throws Exception {
  Har har = server.getHar(); // browserMob proxy
  
  FileOutputStream fos = new FileOutputStream("C:/Downloads/browserMob.har");
  har.writeTo(fos); // browserMob proxy
  server.cleanup(); // browserMob proxy
  server.stop(); // browserMob proxy
  
  this.driver.quit();
  </code></pre>