Establish connection to the AMQP broker.
321167
def establish_connection(self):
        """"""
        conninfo = self.connection
        if not conninfo.hostname:
            raise KeyError("Missing hostname for AMQP connection.")
        if conninfo.userid is None:
            raise KeyError("Missing user id for AMQP connection.")
        if conninfo.password is None:
            raise KeyError("Missing password for AMQP connection.")
        if not conninfo.port:
            conninfo.port = self.default_port
        conn = amqp.Connection(host=conninfo.hostname,
                               port=conninfo.port,
                               userid=conninfo.userid,
                               password=conninfo.password,
                               virtual_host=conninfo.virtual_host)
        return conn
600342
public function connect()
    {
        $connection = $this->_connection;
        $connection->setLogin($this->_config['user']);
        $connection->setPassword($this->_config['password']);
        $connection->setHost($this->_config['host']);
        $connection->setPort($this->_config['port']);
        $connection->setVhost($this->_config['vhost']);
        $connection->setReadTimeout($this->_config['readTimeout']);

        # You shall not use persistent connections
        #
        # AMQPChannelException' with message 'Could not create channel. Connection has no open channel slots remaining
        #
        # The PECL extension is foobar, http://stackoverflow.com/questions/23864647/how-to-avoid-max-channels-per-tcp-connection-with-amqp-php-persistent-connectio
        #

        $connection->connect();
    }
895212
def connect(self):
        """"""
        distributed_logger.info('Connecting registry proxy to ZMQ socket %s', self.socket_addr)
        self.zmq_context = zmq.Context()
        sock = self.zmq_context.socket(zmq.PUB)
        sock.set_hwm(0)
        sock.setsockopt(zmq.LINGER, 0)
        sock.connect(self.socket_addr)
        distributed_logger.info('Connected registry proxy to ZMQ socket %s', self.socket_addr)

        def _reset_socket(values):
            for value in values:
                try:
                    _reset_socket(value.values())
                except AttributeError:
                    value.socket = sock

        distributed_logger.debug('Resetting socket on metrics proxies')
        _reset_socket(self.stats.values())
        self.socket = sock
        distributed_logger.debug('Reset socket on metrics proxies')
64273
private function connect()
    {
        $this->conn = parent::getConn();
        $this->create = $this->conn->prepare($this->create);
    }
346086
@RobotKeyword("Connect to MQTT Broker")
    @ArgumentNames({ "broker", "clientId" })
    public void connectToMQTTBroker(String broker, String clientId)
            throws MqttException {
        client = new MqttClient(broker, clientId);
        System.out.println("*INFO:" + System.currentTimeMillis()
                + "* connecting to broker");
        client.connect();
        System.out.println("*INFO:" + System.currentTimeMillis()
                + "* connected");
    }
376451
def connect(self):
        """"""
        if not self.connect_attempted:
            self.connect_attempted = True
            self.client.connect(self.host, port=self.port)
            self.client.loop_start()

            while not self.connected:
                log.info('waiting for MQTT connection...')
                time.sleep(1)
642307
protected function connect()
	{
		$this->context = new ZMQContext($this->ioThreadTotal, $this->persistent);
		$this->socket  = $this->context->getSocket($this->socketType, $this->persistenceKey);
	    $this->socket->connect($this->connection);
	}
1133896
async def connect(self):
        """"""
        tcp_client = TCPTransport(self.frame_received_cb, self.connection_closed_cb)
        self.transport, _ = await self.loop.create_connection(
            lambda: tcp_client,
            host=self.config.host,
            port=self.config.port,
            ssl=self.create_ssl_context())
        self.connected = True
32381
def connect(self):
        
        self.connection = pika.BlockingConnection(BLOCKING_MQ_PARAMS)
        self.client_queue = ClientQueue()
        self.input_channel = self.connection.channel()

        self.input_channel.exchange_declare(exchange=self.INPUT_EXCHANGE,
                                            type='topic',
                                            durable=True)
        self.input_channel.queue_declare(queue=self.INPUT_QUEUE_NAME)
        self.input_channel.queue_bind(exchange=self.INPUT_EXCHANGE, queue=self.INPUT_QUEUE_NAME)
        log.info("Bind to queue named '%s' queue with exchange '%s'" % (self.INPUT_QUEUE_NAME,
                                                                        self.INPUT_EXCHANGE))
77125
def connect(self):
        """"""
        for m in self.params['MEMBERS']:
            m['ONLINE'] = 0
            m.setdefault('STATUS', 'INVITED')

        self.client = xmpp.Client(self.jid.getDomain(), debug=[])
        conn = self.client.connect(server=self.params['SERVER'])
        if not conn:
            raise Exception("could not connect to server")

        auth = self.client.auth(self.jid.getNode(), self.params['PASSWORD'])
        if not auth:
            raise Exception("could not authenticate as chat server")

        #self.client.RegisterDisconnectHandler(self.on_disconnect)
        self.client.RegisterHandler('message', self.on_message)
        self.client.RegisterHandler('presence',self.on_presence)
        self.client.sendInitPresence(requestRoster=0)

        roster =  self.client.getRoster()
        for m in self.params['MEMBERS']:
            self.invite_user(m, roster=roster)
823383
def connect(self):
        
        logger.info("Connecting to RabbitMQ on {broker_url}...".format(
            broker_url=self.broker_url))

        super(RabbitMQSubscriber, self).connect()

        q = Queue(exchange=self.exchange, exclusive=True, durable=False)

        self.queue = q(self.connection.default_channel)
        self.queue.declare()

        self.thread = Thread(target=self.listen)
        self.thread.setDaemon(True)
        self.thread.start()
1333707
function connect() {
  console.log('Connecting client: ' + clientId + ' to url:"' + url + '"');
  client = mqtt.connect(url, { 'clientId': clientId });
}
624770
function() {
    var me = this;
    var connectionOptions = me._connectionOptions;

    return promised(function(cb) {
      if (me.isConnected || me.status === 'connecting') {
        return cb(new Error('Broker client already connected or connecting.'));
      }

      if (!me.mqttClient) {
        var mqttClient = new PahoMQTT.Client(
          connectionOptions.host,
          connectionOptions.port,
          connectionOptions.path,
          connectionOptions.clientId
        );

        _registerPahoClientEventListeners(me, mqttClient);
        me.mqttClient = mqttClient;
      }

      me.status = 'connecting';
      me.emit('connecting');

      me.mqttClient.connect(
        merge(_getPahoCallbacks(cb), {
          cleanSession: connectionOptions.clean,
          keepAliveInterval: connectionOptions.keepAliveInterval,
          reconnect: connectionOptions.reconnect,
          useSSL: connectionOptions.useSSL
        })
      );
    }).then(function(connectResponse) {
      if (me.enableSubscriptionSyncEvents) {
        me.initSubscriptionSyncEvents();
      }

      return connectResponse;
    });
  }
1249244
void establishConnection () throws IOException {
        synchronized (operationOnConnectionMonitor) {
            if (state == State.CLOSED) {
                throw new IOException("Attempt to establish a connection with a closed connection factory");
            } else if (state == State.CONNECTED) {
                LOGGER.warn("Establishing new connection although a connection is already established");
            }
            try {
                LOGGER.info("Trying to establish connection to {}:{}", getHost(), getPort());
                connection = super.newConnection(executorService);
                connection.addShutdownListener(connectionShutdownListener);
                LOGGER.info("Established connection to {}:{}", getHost(), getPort());
                changeState(State.CONNECTED);
            } catch (IOException e) {
                LOGGER.error("Failed to establish connection to {}:{}", getHost(), getPort());
                throw e;
            }
        }
    }
308824
def setup_zmq(self):
        """"""
        self.context = zmq.Context()
        self.push = self.context.socket(zmq.PUSH)
        self.push_port = self.push.bind_to_random_port("tcp://%s" % self.host)
        # start a listener for the pull socket
        eventlet.spawn(self.zmq_pull)
        eventlet.sleep(0)
497777
def _get_conn(self, host, port, afi):
        """"""
        host_key = (host, port)
        if host_key not in self._conns:
            self._conns[host_key] = BrokerConnection(
                host, port, afi,
                request_timeout_ms=self.timeout * 1000,
                client_id=self.client_id
            )

        conn = self._conns[host_key]
        if not conn.connect_blocking(self.timeout):
            conn.close()
            raise KafkaConnectionError("%s:%s (%s)" % (host, port, afi))
        return conn
423464
def connect(self, username, checksum, password=None, key=None):
        """"""

        ws_url = (
            f"{BASE_WS_URL}?room={self.room.room_id}&cs={checksum}&nick={username}"
            f"&rn={random_id(6)}&t={int(time.time() * 1000)}&transport=websocket&EIO=3"
        )
        if password:
            ws_url += f"&password={password}"
        elif key:
            ws_url += f"&key={key}"

        ARBITRATOR.create_connection(
            self.proto, ws_url, self.headers["User-Agent"], self.cookies
        )
        self.__conn_barrier.wait()