Bug 1033402 - waitForSocket() before connecting to marionette.

The polling happens in nodejs though I guess it might also be useful to have a polling utility function that runs inside gecko