Gets or Creates a {@link IRedisClient} object.

@param host
@param port
@param username
@param password
@param poolConfig
@return
178269
public IRedisClient getRedisClient(final String host, final int port, final String username,
            final String password, final PoolConfig poolConfig) {
        String poolName = calcRedisPoolName(host, port, username, password, poolConfig);

        try {
            JedisClientPool redisClientPool = cacheRedisClientPools.get(poolName,
                    new Callable<JedisClientPool>() {
                        @Override
                        public JedisClientPool call() throws Exception {
                            return createRedisClientPool(host, port, username, password, poolConfig);
                        }
                    });
            return redisClientPool.borrowObject();
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
            return null;
        }
    }
1208353
public static RedisSingleServerConfig buildRedisConfig(String host, int port, String password) {
        RedisSingleServerConfig config = new RedisSingleServerConfig();
        config.setAddress(host + ":" + port);
        config.setPassword(password);
        return config;
    }
586161
def _client(self, host, port, unix_socket, auth):
        
        db = int(self.config['db'])
        timeout = int(self.config['timeout'])
        try:
            cli = redis.Redis(host=host, port=port,
                              db=db, socket_timeout=timeout, password=auth,
                              unix_socket_path=unix_socket)
            cli.ping()
            return cli
        except Exception as ex:
            self.log.error("RedisCollector: failed to connect to %s:%i. %s.",
                           unix_socket or host, port, ex)
1164093
public static DoradusClient open(String host, int port, Credentials credentials, String applicationName) {  
        DoradusClient doradusClient = new DoradusClient(host, port, null, credentials, applicationName);    
        doradusClient.setCredentials(credentials);
        String storageService = lookupStorageServiceByApp(doradusClient.getRestClient(), applicationName);
        doradusClient.setStorageService(storageService);
        return doradusClient;
    }
1088098
public IRedisClient getRedisClient(String host) {
        return getRedisClient(host, IRedisClient.DEFAULT_REDIS_PORT, null, null);
    }
817596
def initialize(name='', pool_size=10, host='localhost', password='', port=5432, user=''):
    

    global pool
    instance = Pool(name=name, pool_size=pool_size, host=host, password=password, port=port, user=user)
    pool = instance
    return instance
361770
def create_redis_client(redis_address, password=None):
    
    redis_ip_address, redis_port = redis_address.split(":")
    # For this command to work, some other client (on the same machine
    # as Redis) must have run "CONFIG SET protected-mode no".
    return redis.StrictRedis(
        host=redis_ip_address, port=int(redis_port), password=password)
972434
public DataSiftConfig proxy(String host, int port, String username, String password) {
        http.proxy(host, port, username, password);
        return this;
    }
896879
public static Endpoint of(String host, int port) {
        validatePort("port", port);
        return create(host, port);
    }
600756
function get_pool (port, host, local_addr, is_unix_socket, max) {
    port = port || 25;
    host = host || 'localhost';
    const name = `outbound::${port}:${host}:${local_addr}:${cfg.pool_timeout}`;
    if (!server.notes.pool) server.notes.pool = {};
    if (server.notes.pool[name]) return server.notes.pool[name];

    const pool = generic_pool.Pool({
        name,
        create: function (done) {
            _create_socket(this.name, port, host, local_addr, is_unix_socket, done);
        },
        validate: socket => socket.__fromPool && socket.writable,
        destroy: socket => {
            logger.logdebug(`[outbound] destroying pool entry ${socket.__uuid} for ${host}:${port}`);
            socket.removeAllListeners();
            socket.__fromPool = false;
            socket.on('line', line => {
                // Just assume this is a valid response
                logger.logprotocol(`[outbound] S: ${line}`);
            });
            socket.once('error', err => {
                logger.logwarn(`[outbound] Socket got an error while shutting down: ${err}`);
            });
            socket.once('end', () => {
                logger.loginfo("[outbound] Remote end half closed during destroy()");
                socket.destroy();
            })
            if (socket.writable) {
                logger.logprotocol(`[outbound] [${socket.__uuid}] C: QUIT`);
                socket.write("QUIT\r\n");
            }
            socket.end(); // half close
        },
        max: max || 10,
        idleTimeoutMillis: cfg.pool_timeout * 1000,
        log: (str, level) => {
            if (/this._availableObjects.length=/.test(str)) return;
            level = (level === 'verbose') ? 'debug' : level;
            logger[`log${level}`](`[outbound] [${name}] ${str}`);
        }
    });
    server.notes.pool[name] = pool;

    return pool;
}
258902
public static Server getServer(final Object instance, final String bindAddress, final int port, Configuration conf) 
    throws IOException {
    return getServer(instance, bindAddress, port, 1, false, conf);
  }
905916
def add_or_renew_pool(self, host, is_host_addition):
        
        distance = self._profile_manager.distance(host)
        if distance == HostDistance.IGNORED:
            return None

        def run_add_or_renew_pool():
            try:
                if self._protocol_version >= 3:
                    new_pool = HostConnection(host, distance, self)
                else:
                    # TODO remove host pool again ???
                    new_pool = HostConnectionPool(host, distance, self)
            except AuthenticationFailed as auth_exc:
                conn_exc = ConnectionException(str(auth_exc), host=host)
                self.cluster.signal_connection_failure(host, conn_exc, is_host_addition)
                return False
            except Exception as conn_exc:
                log.warning("Failed to create connection pool for new host %s:",
                            host, exc_info=conn_exc)
                # the host itself will still be marked down, so we need to pass
                # a special flag to make sure the reconnector is created
                self.cluster.signal_connection_failure(
                    host, conn_exc, is_host_addition, expect_host_to_be_down=True)
                return False

            previous = self._pools.get(host)
            with self._lock:
                while new_pool._keyspace != self.keyspace:
                    self._lock.release()
                    set_keyspace_event = Event()
                    errors_returned = []

                    def callback(pool, errors):
                        errors_returned.extend(errors)
                        set_keyspace_event.set()

                    new_pool._set_keyspace_for_all_conns(self.keyspace, callback)
                    set_keyspace_event.wait(self.cluster.connect_timeout)
                    if not set_keyspace_event.is_set() or errors_returned:
                        log.warning("Failed setting keyspace for pool after keyspace changed during connect: %s", errors_returned)
                        self.cluster.on_down(host, is_host_addition)
                        new_pool.shutdown()
                        self._lock.acquire()
                        return False
                    self._lock.acquire()
                self._pools[host] = new_pool

            log.debug("Added pool for host %s to session", host)
            if previous:
                previous.shutdown()

            return True

        return self.submit(run_add_or_renew_pool)
655927
public static ContentSource getInputContentSource(Configuration conf,
            String host) 
    throws XccConfigException, IOException {      
        String user = conf.get(INPUT_USERNAME, "");
        String password = conf.get(INPUT_PASSWORD, "");
        String port = conf.get(INPUT_PORT,"8000");
        String db = conf.get(INPUT_DATABASE_NAME);
        int portInt = Integer.parseInt(port);
        boolean useSsl = conf.getBoolean(INPUT_USE_SSL, false);
        if (useSsl) {
            return getSecureContentSource(host, portInt, user, password, 
                        db, getInputSslOptions(conf));
        }
        return ContentSourceFactory.newContentSource(host, portInt, 
                user, password, db);
    }
881707
public static JMXConnector connect(final String hostportOrPid, final String login, final String password)
			throws IOException {
		// ./vjmxcli.sh - 127.0.0.1:8060 gcutil
		if (hostportOrPid.contains(":")) {
			JMXServiceURL rmiurl = new JMXServiceURL(
					"service:jmx:rmi://" + hostportOrPid + "/jndi/rmi://" + hostportOrPid + "/jmxrmi");
			return JMXConnectorFactory.connect(rmiurl, formatCredentials(login, password));
		} else {
			// ./vjmxcli.sh - 112222 gcutil
			String localAddress = getLocalConnectorAddress(hostportOrPid);
			JMXServiceURL localRmiurl = new JMXServiceURL(localAddress);
			return JMXConnectorFactory.connect(localRmiurl);
		}
	}
492608
def connection_from_host(self, host, port=None, scheme='http'):
        

        if not host:
            raise LocationValueError("No host specified.")

        scheme = scheme or 'http'
        port = port or port_by_scheme.get(scheme, 80)
        pool_key = (scheme, host, port)

        with self.pools.lock:
            # If the scheme, host, or port doesn't match existing open
            # connections, open a new ConnectionPool.
            pool = self.pools.get(pool_key)
            if pool:
                return pool

            # Make a fresh ConnectionPool of the desired type
            pool = self._new_pool(scheme, host, port)
            self.pools[pool_key] = pool

        return pool
596285
public static SshConnection getConnection(String host, int port,
                                              Authentication authentication) throws IOException {
        return getConnection(host, port, GerritDefaultValues.DEFAULT_GERRIT_PROXY, authentication);
    }
646658
public static AzkabanDataSource getMySQLDataSource(final String host, final Integer port,
      final String dbName, final String user, final String password, final Integer numConnections) {
    return new MySQLBasicDataSource(host, port, dbName, user, password,
        numConnections);
  }