title: Selenium occasional UnreachableBrowserException
body: <p>I am trying to access several websites by using Selenium in Java. Occasionally, I get an <code>UnreachableBrowserException</code>. I have read many threads about this error but it seems like there are many different causes of the error. I get the error about 1% of the time when I attempt to access a new page and I cannot find any similarities between occurrences. I currently am using Firefox, however I have also tried Internet Explorer and experienced similar errors. I am only opening one page at a time and have tried using the same window and completely quitting the driver before trying to access another page and either way the error still occurs. It is important to note I do not always get this error sometimes my code can run without this occurring. Here is the error message:</p>
  
  <pre><code>Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: I/O exception (java.net.SocketException) caught when processing request to {}-      http://127.0.0.1:7055: Permission denied: connect
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: Retrying request to {}-&gt;http://127.0.0.1:7055
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: I/O exception (java.net.SocketException) caught when processing request to {}-&gt;http://127.0.0.1:7055: Permission denied: connect
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: Retrying request to {}-&gt;http://127.0.0.1:7055
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: I/O exception (java.net.SocketException) caught when processing request to {}-&gt;http://127.0.0.1:7055: Permission denied: connect
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: Retrying request to {}-&gt;http://127.0.0.1:7055
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: I/O exception (java.net.SocketException) caught when processing request to {}-&gt;http://127.0.0.1:7055: Permission denied: connect
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: Retrying request to {}-&gt;http://127.0.0.1:7055
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: I/O exception (java.net.SocketException) caught when processing request to {}-&gt;http://127.0.0.1:7055: Permission denied: connect
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: Retrying request to {}-&gt;http://127.0.0.1:7055
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: I/O exception (java.net.SocketException) caught when processing request to {}-&gt;http://127.0.0.1:7055: Permission denied: connect
  Jan 12, 2015 10:39:40 PM org.apache.http.impl.execchain.RetryExec execute
  INFO: Retrying request to {}-&gt;http://127.0.0.1:7055
  Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
  Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:03:00'
  System info: host: '****', ip: '**.*.*.*', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_60'
  Driver info: driver.version: RemoteWebDriver
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:614)
      at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:468)
      at scrape.Scraper.killInstance(Scraper.java:162)
      at scrape.Updater.main(Updater.java:93)
  Caused by: java.net.SocketException: Permission denied: connect
      at java.net.DualStackPlainSocketImpl.connect0(Native Method)
      at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
      at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
      at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
      at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
      at java.net.PlainSocketImpl.connect(Unknown Source)
      at java.net.SocksSocketImpl.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source)
      at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:72)
      at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
      at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
      at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
      at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
      at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
      at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
      at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
      at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
      at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:215)
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)
      at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:165)
      at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:362)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
      ... 4 more
  </code></pre>
  
  <p>How can I prevent this error or at least catch the error and deal with it effectively?</p>