Setup the connection
495128
def setup(self):
        """"""
        global cluster, session

        if 'username' in self.cluster_options or 'password' in self.cluster_options:
            raise CQLEngineException("Username & Password are now handled by using the native driver's auth_provider")

        if self.lazy_connect:
            return

        self.cluster = Cluster(self.hosts, **self.cluster_options)
        try:
            self.session = self.cluster.connect()
            log.debug(format_log_context("connection initialized with internally created session", connection=self.name))
        except NoHostAvailable:
            if self.retry_connect:
                log.warning(format_log_context("connect failed, setting up for re-attempt on first use", connection=self.name))
                self.lazy_connect = True
            raise

        if self.consistency is not None:
            self.session.default_consistency_level = self.consistency

        if DEFAULT_CONNECTION in _connections and _connections[DEFAULT_CONNECTION] == self:
            cluster = _connections[DEFAULT_CONNECTION].cluster
            session = _connections[DEFAULT_CONNECTION].session

        self.setup_session()
846638
def _start_connection_setup(self):
        """"""
        logger.info('We are connected[%s], request connection setup',
                    self.link_uri)
        self.platform.fetch_platform_informations(self._platform_info_fetched)
491814
def connect(self):
        ""

        #
        # source_address é atributo incluído na versão 2.7 do Python
        # Verificando a existência para funcionar em versões anteriores à 2.7
        #
        if hasattr(self, 'source_address'):
            sock = socket.create_connection((self.host, self.port), self.timeout, self.source_address)
        else:
            sock = socket.create_connection((self.host, self.port), self.timeout)

        if self._tunnel_host:
            self.sock = sock
            self._tunnel()

        if sys.version_info >= (2,7,13):
            self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_TLS, do_handshake_on_connect=False)
        else:
            self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_SSLv23, do_handshake_on_connect=False)
1055251
async def connect(self):
        
        self.pool = await aiomysql.create_pool(
            loop=self.loop,
            db=self.database,
            connect_timeout=self.timeout,
            **self.connect_params)
788327
def connectRelay(self):
        
        self.protocol = self.connector.buildProtocol(None)
        self.connected = True
        self.protocol.makeConnection(self)
1204832
def connect(self):
        """"""
        super(TLSTransport, self).connect()
        self.socket = ssl.wrap_socket(
            self.socket,
            ssl_version=ssl.PROTOCOL_TLSv1,
            cert_reqs=ssl.CERT_REQUIRED,
            ca_certs=self.ca_certs)
520166
def connect(self):
        ""
        family, stype, proto, cname, sockaddr = self.best_connection_params(
            self.host, self.port)
        self.sock = socket.socket(family, stype)
        self.sock.settimeout(self.timeout)
        self.sock.connect(sockaddr)
977877
def _connect(self):
        """"""
        log.debug("Connecting to JLigier")
        self.socket = socket.socket()
        self.socket.connect((self.host, self.port))
106726
function connect() {
    // clear pending timeouts
    clearTimeout(timeoutConnectRef);

    // if client already open, just run
    if (client.isOpen) {
        run();
    }

    // if client closed, open a new connection
    client.connectTCP("127.0.0.1", { port: 8502 })
        .then(setClient)
        .then(function() {
            console.log("Connected"); })
        .catch(function(e) {
            checkError(e);
            console.log(e.message); });
}
760828
private function connect()
    {
        $this->conn = parent::getConn();
        $this->update = $this->conn->prepare($this->update);
    }
781609
def __setup_connection(self):
            
        if self.payload != None and type(self.payload) is dict and 'settings' in self.payload:
            config.plugin_client_settings = self.payload['settings']
        config.offline = self.args.offline
        config.connection = PluginConnection(
            client=self.args.client or 'SUBLIME_TEXT_3',
            ui=self.args.ui_switch,
            args=self.args,
            params=self.payload,
            operation=self.operation,
            verbose=self.args.verbose)
        config.project = MavensMateProject(params=self.payload,ui=self.args.ui_switch)
        config.sfdc_client = config.project.sfdc_client
1340460
function setupConnection( options ) {
  var db

  // force this connect option to exist as true
  // http://mongoosejs.com/docs/connections.html#use-mongo-client
  if ( !options.connect.useMongoClient ) {
    options.connect.useMongoClient = true
  }

  // http://mongoosejs.com/docs/promises.html#plugging-in-your-own-promises-library
  mongoose.Promise = global.Promise
  mongoose.set( 'debug', options.debug === true )

  db = mongoose.connection

  if ( options.debug === true ) {
    db.on( 'connected', eventLogger( 'connected', db ) )
    db.on( 'connecting', eventLogger( 'connecting', db ) )
    db.on( 'disconnected', eventLogger( 'disconnected', db ) )
    db.on( 'open', eventLogger( 'open', db ) )
    db.on( 'reconnected', eventLogger( 'reconnected', db ) )
  }

  db.on( 'error', eventLogger( 'error', db ) )
  db.on( 'error', attachErrorToDb( db ) )

  db.uri = getUri( options.uri )

  process.on( 'SIGINT',
    function () {
      mongoose.connection.close(
        function () {
          console.log( 'mongoose default connection disconnected through app termination' )
          process.exit( 0 )
        }
      );
    }
  )

  return db
}
1037218
def _connect(self):
        """"""
        if self._connParams:
            self._conn = MySQLdb.connect(**self._connParams)
        else:
            self._conn = MySQLdb.connect('')
511209
def connect(self):
        
        try:
            self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)

            if has_timeout(self.timeout):
                self.sock.settimeout(self.timeout)

            self.sock.connect(unquote(self.host))
        except socket.error as msg:
            if self.sock:
                self.sock.close()
            self.sock = None

            raise socket.error(msg)
1316856
def connect(self):
        """"""
        # Standard implementation from HTTPSConnection, which is not
        # designed for extension, unfortunately
        sock = socket.create_connection((self.host, self.port),
                                        self.timeout, self.source_address)
        if getattr(self, '_tunnel_host', None):
            self.sock = sock  # pragma: no cover
            self._tunnel()  # pragma: no cover

        # This is the only difference; default wrap_socket uses SSLv23
        self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file,
                                    ssl_version=ssl.PROTOCOL_TLSv1_2)
282380
public void connect() {
        doConnect(() -> {
            return CommandContextFactory.getInstance().
                    newCommandContext(new CommandContextConfiguration.Builder()
                    .setErrorOnInteract(false)
                    .build());
        });
    }
1026012
function setup(connection) {

                node.connection = connection;

                // node connected
                node.status({ fill: 'green', shape: 'dot', text: 'connected' });

                // build receiver options based on node configuration
                var options = {
                    source: {
                        address: node.address,
                        dynamic: node.dynamic,
                        durable: node.durable,
                        expiry_policy: node.expirypolicy
                     },
                    credit_window: node.creditwindow,
                    autoaccept: node.autoaccept,
                    snd_settle_mode: node.sndsettlemode,
                    rcv_settle_mode: node.rcvsettlemode
                };

                node.receiver = node.connection.open_receiver(options);

                node.receiver.on('message', function(context) {
                    var msg = {
                        payload: context.message,
                        delivery: context.delivery
                    };
                    node.send(msg);
                });

                node.connection.on('disconnected', function(context) {
                    // node disconnected
                    node.status({fill: 'red', shape: 'dot', text: 'disconnected' });
                });

                node.on('input', function(msg) {
                    if (msg.credit) {
                        node.receiver.flow(msg.credit);
                    }
                });

                node.on('close', function() {
                    if (node.receiver != null)
                        node.receiver.detach();
                    node.connection.close();
                });
            }