title: Webdriver Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
body: <p>I have box where I run tests. It seems like Jenkins would ssh in and execute commands described in the specific job that's running. </p>
  
  <p>Here I am trying to run my Selenium Webdriver tests, but it tells me that I have errors in launching firefox. The end idea is to run the webtests on this box entirely, and also take some screenshots of errors. </p>
  
  <p>I am using selenium-java-2.25.jar, firefox 10, linux OS.</p>
  
  <p>The funny thing is that I can ssh in manually into the box, temporarily copy the magic cookie from another user on the box (to get an X tunnel), do an <code>export DISPLAY=mydisplay:1.0</code>, then launch my selenium tests using ant. And this will bring up firefox and the tests just fine.</p>
  
  <p>There are various threads here that seem to have the exact same problem, and I think I've tried most of them. Here is what I've done:</p>
  
  <ul>
  <li><p>Reboot the box, log back in with VNC. </p></li>
  <li><p>Placed a bash script in Jenkins to run before running selenium tests. The bash script basically just does an <code>export DISPLAY=mydisplay:1.0</code>. It also executes <code>xclock</code>. This works as I can see xclock being displayed in the VNC. </p></li>
  <li><p>iptables have been turned off</p></li>
  <li><p>firefox is correctly located in /usr/bin/firefox</p></li>
  <li><p>sshd_config shows having X11Forwarding as true.</p></li>
  <li><p>Supposedly downgrading firefox helped some people, but I do not wish to do this. Webdriver should support FF 10 anyway.</p></li>
  </ul>
  
  <p>However, none of the above solves the problem.</p>
  
  <p>It doesn't seem like port 7055 on localhost even exists:</p>
  
  <p><code>netstat -an | grep 7055</code> - Nothing prints</p>
  
  <p>This is what my /etc/hosts says:</p>
  
  <pre><code>  1 127.0.0.1               localhost.localdomain localhost
    2 ::1             localhost6.localdomain6 localhost6
  </code></pre>
  
  <p>Perhaps it has something to do with localhost:7055 not existing? I am unsure where to go from here. still, why does the error output say it's looking for <code>display: :0.0</code> when I've specified <code>mydisplay:1.0</code>?</p>
  
  <p>And finally the error output I receive:</p>
  
  <pre><code>[testng] org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
  [testng] Xlib: connection to ":0.0" refused by server
  [testng] Xlib: No protocol specified
  [testng] 
  [testng] Error: cannot open display: :0.0
  [testng] Xlib: connection to ":0.0" refused by server
  [testng] Xlib: No protocol specified
  [testng] 
  [testng] Xlib: connection to ":0.0" refused by server
  [testng] Xlib: No protocol specified
  [testng] 
  [testng] Xlib: connection to ":0.0" refused by server
  [testng] Xlib: No protocol specified
  [testng] 
  [testng] Error: cannot open display: :0.0
  [testng] 
  [testng]    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:109)
  [testng]    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:245)
  [testng]    at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:109)
  [testng]    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:185)
  [testng]    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:178)
  [testng]    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:174)
  [testng]    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:92)
  [testng]    at com.test.webtest.browser.BrowserFactory.createBrowser(BrowserFactory.java:24)
  [testng]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  [testng]    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  [testng]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  [testng]    at java.lang.reflect.Method.invoke(Method.java:601)
  </code></pre>