class Selenium::WebDriver::SocketLock

def lock

def lock
  max_time = current_time + @timeout
  sleep 0.1 until can_lock? || current_time >= max_time
  return if did_lock?
  raise Error::WebDriverError, "unable to bind to locking port #{@port} within #{@timeout} seconds"
end