Request the connection to be established

        :param int wanInterfaceId: the id of the WAN interface
        :param float timeout: the timeout to wait for the action to be executed
16112
def requestConnection(self, wanInterfaceId=1, timeout=1):
        
        namespace = Wan.getServiceType("requestConnection") + str(wanInterfaceId)
        uri = self.getControlURL(namespace)

        self.execute(uri, namespace, "RequestConnection", timeout=timeout)
863428
private Connection<CL> waitForConnection(int timeout) throws ConnectionException {
        Connection<CL> connection = null;
        long startTime = System.currentTimeMillis();
        try {
            blockedThreads.incrementAndGet();
            connection = availableConnections.poll(timeout, TimeUnit.MILLISECONDS);
            if (connection != null)
                return connection;
            
            throw new PoolTimeoutException("Timed out waiting for connection")
                .setHost(getHost())
                .setLatency(System.currentTimeMillis() - startTime);
        }
        catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new InterruptedOperationException("Thread interrupted waiting for connection")
                .setHost(getHost())
                .setLatency(System.currentTimeMillis() - startTime);
        }
        finally {
            blockedThreads.decrementAndGet();
        }
    }
276941
def open_interface_async(self, conn_id, interface, callback, connection_string=None):
        """"""

        future = self._loop.launch_coroutine(self._adapter.open_interface(conn_id, interface))
        future.add_done_callback(lambda x: self._callback_future(conn_id, x, callback))
416796
static <V extends VersionedProtocol> V waitForProxy(Class<V> protocol, InetSocketAddress addr,
			long timeout) throws IOException {
		long startTime = System.currentTimeMillis();
		IOException ioe;
		while (true) {
			try {
				return getProxy(protocol, addr);
			} catch (ConnectException se) { // namenode has not been started
				LOG.info("Server at " + addr + " not available yet, Zzzzz...");
				ioe = se;
			} catch (SocketTimeoutException te) { // namenode is busy
				LOG.info("Problem connecting to server: " + addr);
				ioe = te;
			}
			// check if timed out
			if (System.currentTimeMillis() - timeout >= startTime) {
				throw ioe;
			}

			// wait for retry
			try {
				Thread.sleep(1000);
			} catch (InterruptedException ie) {
				// IGNORE
			}
		}
	}
305693
def wait_for_connection(self, timeout=10):
        
        start_time = datetime.datetime.now()
        while True:
            if self.connected:
                return True
            now = datetime.datetime.now()
            if (now - start_time).total_seconds() > timeout:
                return False
            time.sleep(0.5)
268320
public void connect(SocketAddress endpoint, int timeout) throws IOException {
    String filename;
    if (host == null || host.equals("localhost")) {
      filename = "\\\\.\\pipe\\" + name;
    } else {
      filename = "\\\\" + host + "\\pipe\\" + name;
    }

    //use a default timeout of 100ms if no timeout set.
    int usedTimeout = timeout == 0 ? 100 : timeout;
    long initialNano = System.nanoTime();
    do {
      try {
        file = new RandomAccessFile(filename, "rw");
        break;
      } catch (FileNotFoundException fileNotFoundException) {
        try {
          //using JNA if available
          Kernel32.INSTANCE.WaitNamedPipe(filename, timeout);
          //then retry connection
          file = new RandomAccessFile(filename, "rw");
        } catch (Throwable cle) {
          // in case JNA not on classpath, then wait 10ms before next try.
          if (System.nanoTime() - initialNano > TimeUnit.MILLISECONDS.toNanos(usedTimeout)) {
            if (timeout == 0) {
              throw new FileNotFoundException(fileNotFoundException.getMessage()
                  + "\nplease consider set connectTimeout option, so connection can retry having access to named pipe. "
                  + "\n(Named pipe can throw ERROR_PIPE_BUSY error)");
            }
            throw fileNotFoundException;
          }
          try {
            TimeUnit.MILLISECONDS.sleep(5);
          } catch (InterruptedException interrupted) {
            IOException ioException = new IOException(
                "Interruption during connection to named pipe");
            ioException.initCause(interrupted);
            throw ioException;
          }
        }
      }
    } while (true);

    is = new InputStream() {
      @Override
      public int read(byte[] bytes, int off, int len) throws IOException {
        return file.read(bytes, off, len);
      }

      @Override
      public int read() throws IOException {
        return file.read();
      }

      @Override
      public int read(byte[] bytes) throws IOException {
        return file.read(bytes);
      }
    };

    os = new OutputStream() {
      @Override
      public void write(byte[] bytes, int off, int len) throws IOException {
        file.write(bytes, off, len);
      }

      @Override
      public void write(int value) throws IOException {
        file.write(value);
      }

      @Override
      public void write(byte[] bytes) throws IOException {
        file.write(bytes);
      }
    };
  }
714789
function (timeout, hash, uuid) {
    this.actionQueue.push(this.webdriverClient.implicitWait.bind(this.webdriverClient, timeout));
    this.actionQueue.push(this._waitCb.bind(this, timeout, hash, uuid));
    return this;
  }
443575
def _connect(self):
        
        timeout = None
        if self._options is not None and 'timeout' in self._options:
            timeout = self._options['timeout']

        if self._client._credentials:
            self._connection = self._connection_class(
                host=self._node.host,
                port=self._node.http_port,
                credentials=self._client._credentials,
                timeout=timeout)
        else:
            self._connection = self._connection_class(
                    host=self._node.host,
                    port=self._node.http_port,
                    timeout=timeout)
        # Forces the population of stats and resources before any
        # other requests are made.
        self.server_version
364695
async def wait_for_group(self, container, networkid, timeout = 120):
        
        if networkid in self._current_groups:
            return self._current_groups[networkid]
        else:
            if not self._connection.connected:
                raise ConnectionResetException
            groupchanged = VXLANGroupChanged.createMatcher(self._connection, networkid, VXLANGroupChanged.UPDATED)
            conn_down = self._connection.protocol.statematcher(self._connection)
            timeout_, ev, m = await container.wait_with_timeout(timeout, groupchanged, conn_down)
            if timeout_:
                raise ValueError('VXLAN group is still not created after a long time')
            elif m is conn_down:
                raise ConnectionResetException
            else:
                return ev.physicalportid
888890
def request(self, method, url, **kwargs):
        
        if 'timeout' not in kwargs:
            if self.timeout is not None:
                kwargs['timeout'] = self.timeout
            else:
                kwargs['timeout'] = (DEFAULT_CONNECT_TIMEOUT,
                                     DEFAULT_READ_TIMEOUT)
        return super(Session, self).request(method=method, url=url, **kwargs)
1148077
def tcp_socket_request
      Timeout.timeout(request_timeout) do
        s = TCPSocket.new(host, port)
        s.close
      end
    rescue Errno::ECONNREFUSED => e
      addl_message = "#{host} is not accepting connections on port #{port}: "
      raise ConnectionFailed, addl_message + e.message
    rescue SocketError => e
      addl_message = "connection to #{host} on port #{port} failed with '#{e.message}': "
      raise ConnectionFailed, addl_message + e.message
    rescue Timeout::Error => e
      addl_message = "#{host} did not respond on port #{port} within #{request_timeout} seconds: "
      raise ConnectionFailed, addl_message + e.message
    rescue => e
      raise ConnectionFailed, e
    end
726120
def _timeoutRequest(self, msgId):
        
        d, _ = self._requests.pop(msgId, (None, None))
        if not d.called:
            d.errback(ZmqRequestTimeoutError(msgId))
982060
public final Connection connectNow(Duration timeout) {
		Objects.requireNonNull(timeout, "timeout");
		try {
			return Objects.requireNonNull(connect().block(timeout), "aborted");
		}
		catch (IllegalStateException e) {
			if (e.getMessage().contains("blocking read")) {
				throw new IllegalStateException("TcpClient couldn't be started within "
						+ timeout.toMillis() + "ms");
			}
			throw e;
		}
	}
592637
public void setResponseTimeout(int timeout) {
        try {
            getConnection().setReadTimeout(timeout);
        } catch (Exception e) {
            Modbus.log().warning(e.getLocalizedMessage());
        }
    }
1075227
def req(self, message_id, timeout):
        ''''''
        return self.send(constants.REQ + ' ' + message_id + ' ' + str(timeout))
365550
def connect(self, clientId=0, host="localhost", port=4001):
        
        self.clientId = clientId
        self.host = host
        self.port = port
        self.ibConn = Connection.create(
            host=self.host,
            port=int(self.port),
            clientId=self.clientId
        )

        # Assign server messages handling function.
        self.ibConn.registerAll(self.handleServerEvents)

        # connect
        self.log.info("[CONNECTING TO IB]")
        self.ibConn.connect()

        # get server time
        self.getServerTime()

        # subscribe to position and account changes
        self.subscribeAccount = False
        self.requestAccountUpdates(subscribe=True)

        self.subscribePositions = False
        self.requestPositionUpdates(subscribe=True)

        # load working orders
        self.requestOpenOrders()

        # force refresh of orderId upon connect
        self.handleNextValidId(self.orderId)

        self._disconnected_by_user = False
        time.sleep(1)
538269
def setChannel(self, channel, wifiInterfaceId=1, timeout=1):
        
        namespace = Wifi.getServiceType("setChannel") + str(wifiInterfaceId)
        uri = self.getControlURL(namespace)

        self.execute(uri, namespace, "SetChannel", timeout=timeout, NewChannel=channel)