Get the client.

@return the client
433427
public HttpClient get() {
    final ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager();
    cm.setMaxTotal(nrOfThreads);
    cm.setDefaultMaxPerRoute(maxToRoute);
    final DefaultHttpClient client = HTTPSFaker.getClientThatAllowAnyHTTPS(cm);

    client.getParams().setParameter("http.socket.timeout", socketTimeout);
    client.getParams().setParameter("http.connection.timeout", connectionTimeout);

    client.addRequestInterceptor(new RequestAcceptEncoding());
    client.addResponseInterceptor(new ResponseContentEncoding());
    
    CookieSpecFactory csf = new CookieSpecFactory() {
      public CookieSpec newInstance(HttpParams params) {
        return new BestMatchSpecWithURLErrorLog();
      }
    };

    client.getCookieSpecs().register("bestmatchwithurl", csf);
    client.getParams().setParameter(ClientPNames.COOKIE_POLICY, "bestmatchwithurl");

    if (!"".equals(proxy)) {
      StringTokenizer token = new StringTokenizer(proxy, ":");

      if (token.countTokens() == 3) {
        String proxyProtocol = token.nextToken();
        String proxyHost = token.nextToken();
        int proxyPort = Integer.parseInt(token.nextToken());

        HttpHost proxy = new HttpHost(proxyHost, proxyPort, proxyProtocol);
        client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
      } else
        System.err.println("Invalid proxy configuration: " + proxy);
    }

    if (auths.size() > 0) {

      for (Auth authObject : auths) {
        client.getCredentialsProvider().setCredentials(
            new AuthScope(authObject.getScope(), authObject.getPort()),
            new UsernamePasswordCredentials(authObject.getUserName(), authObject.getPassword()));
      }
    }

    return client;
  }
1330635
public static KeenClient client() {
        if (ClientSingleton.INSTANCE.client == null) {
            throw new IllegalStateException("Please call KeenClient.initialize() before requesting the client.");
        }
        return ClientSingleton.INSTANCE.client;
    }
770648
public static function getHttpClient()
    {
        if(self::$httpClient) {
            return self::$httpClient;
        }
        $client = new Client();
        return self::$httpClient = $client;
    }
1234041
protected function client()
    {
        $apiKey = $this->config('apiKey');
        if (!$apiKey) {
            return null;
        }

        $endpoint = $this->config('endpoint');
        $defaults = $this->config('defaults');
        if ($defaults === null) {
            $defaults = true;
        }
        $client = Client::make($apiKey, $endpoint, $defaults);

        return $client;
    }
224632
def client(self):
        
        if not hasattr(self, "_client"):
            self._client = connections.get_connection("default")
        return self._client
703990
def get_client(self, provider):
        ""
        if self.client_class is not None:
            return self.client_class(provider)
        return get_client(provider)
896925
def Get(self):
    """"""

    args = client_pb2.ApiGetClientArgs(client_id=self.client_id)
    result = self._context.SendRequest("GetClient", args)
    return Client(data=result, context=self._context)
3170
function getClient()
    {
        $transport = $this->getTransport();
        $transport->setAuth($this->username, $this->password);

        return new Client($transport);
    }
1108217
public function getActiveClient()
    {
        foreach ($this->getClients() as $id => $client) {
            $token = $client->getAccessToken();
            if ($token) {
                return $client;
            }
        }

        return;
    }
1328178
def client(self):
        
        if self._client is None:
            self._client = self._get_client()
        return self._client
1118616
public function getHttpClient()
    {
        if (is_null($this->httpClient)) {
            $this->httpClient = $this->getDefaultHttpClient();
        }

        return $this->httpClient;
    }
465829
def client(self):
        
        if self._client is None:
            self._client = Client_(self.servers)
        return self._client
670063
protected function getClient(): HttpClient
    {
        if ($this->_client == null) {
            $this->_client = new HttpClient(['base_uri' => $this->_endpoint]);
        }

        return $this->_client;
    }
383415
@Override
    public Client getClientInstance()
    {
        // if threadsafe recycle the same single instance; if not create a new
        // instance

        if (isThreadSafe())
        {
            logger.info("Returning threadsafe used client instance for persistence unit : " + persistenceUnit);
            if (client == null)
            {
                client = instantiateClient(persistenceUnit);
            }
        }
        else
        {
            logger.debug("Returning fresh client instance for persistence unit : " + persistenceUnit);
            // no need to hold a client reference.
            return instantiateClient(persistenceUnit);
        }

        return client;
    }
879241
public Client getClient(int clientId) throws Exception {
        Client client = null;

        PreparedStatement statement = null;
        ResultSet results = null;
        try (Connection sqlConnection = sqlService.getConnection()) {
            String queryString = "SELECT * FROM " + Constants.DB_TABLE_CLIENT +
                " WHERE " + Constants.GENERIC_ID + " = ?";

            statement = sqlConnection.prepareStatement(queryString);
            statement.setInt(1, clientId);

            results = statement.executeQuery();
            if (results.next()) {
                client = this.getClientFromResultSet(results);
            }
        } catch (Exception e) {
            throw e;
        } finally {
            try {
                if (results != null) {
                    results.close();
                }
            } catch (Exception e) {
            }
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }

        return client;
    }
265285
public function getUserClient()
    {
        if (!$this->userClient) {
            $this->userClient = Factory::getUserClient(
                null, $this->configuration->getApiKey(), [Factory::API_BASE_URL => $this->configuration->getApiUri()]
            );
        }

        return $this->userClient;
    }
522007
public Client<? extends Options, ? extends OptionsBuilder, ? extends RequestBuilder> newClient() {
        if (clientClassName == null) {
            return new DefaultClient();
        } else {
            try {
                return (Client) Thread.currentThread().getContextClassLoader().loadClass(clientClassName).newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }