Creates a WebClient instance
@return WebClient instance
763358
public WebClient createWebClient() {
        String serviceAddress = getAddress();
        int queryIndex = serviceAddress != null ? serviceAddress.lastIndexOf('?') : -1;
        if (queryIndex != -1) {
            serviceAddress = serviceAddress.substring(0, queryIndex);
        }
        Service service = new JAXRSServiceImpl(serviceAddress, getServiceName());
        getServiceFactory().setService(service);

        try {
            Endpoint ep = createEndpoint();
            this.getServiceFactory().sendEvent(FactoryBeanListener.Event.PRE_CLIENT_CREATE, ep);
            ClientState actualState = getActualState();
            WebClient client = actualState == null ? new WebClient(getAddress())
                : new WebClient(actualState);
            initClient(client, ep, actualState == null);

            notifyLifecycleManager(client);
            this.getServiceFactory().sendEvent(FactoryBeanListener.Event.CLIENT_CREATED, client, ep);

            return client;
        } catch (Exception ex) {
            LOG.severe(ex.getClass().getName() + " : " + ex.getLocalizedMessage());
            throw new RuntimeException(ex);
        }
    }
845260
protected function getHttpClient()
    {
        if (is_null($this->httpClient)) {
            $this->httpClient = new Client($this->guzzle);
        }

        return $this->httpClient;
    }
721575
protected function getClient(): HttpClient
    {
        if ($this->client === null) {
            $this->client = new HttpClient($this->getClientConfig());
        }

        return $this->client;
    }
62595
protected function createClient()
    {
        $this->client = new OAuthServer([
            'identifier' => Configuration::get('key'),
            'secret' => Configuration::get('secret'),
            'callback_uri' => Configuration::get('callbackUrl'),
            'name' => Configuration::get('name'),
            'expiration' => Configuration::get('expiration'),
            'scope' => Configuration::get('scope'),
        ]);

        return $this;
    }
1025832
public function getHttpClient()
    {
        if (!is_object($this->_httpClient)) {
            $stack = HandlerStack::create();
            $middleware = new Rpc([
                'accessKeyId' => $this->accessKeyId,
                'accessSecret' => $this->accessSecret,
                'Version' => $this->version
            ]);
            $stack->push($middleware);

            $this->_httpClient = new HttpClient([
                'base_uri' => $this->baseUri,
                'handler' => $stack,
                'verify' => false,
                'http_errors' => false,
                'connect_timeout' => 3,
                'read_timeout' => 10,
                'debug' => false,
            ]);
        }
        return $this->_httpClient;
    }
1011090
public function createDefaultHttpClient()
    {
        $stack = HandlerStack::create();

        $middleware = new Oauth1([
            'consumer_key'    => $this->consumerKey,
            'consumer_secret' => $this->consumerSecret,
            'token'           => $this->token,
            'token_secret'    => $this->tokenSecret
        ]);

        $stack->push($middleware);

        return new HttpClient([
            'handler' => $stack
        ]);
    }
1016229
public function getHttpClient()
    {
        if (!is_object($this->_httpClient)) {
            $this->_httpClient = new Client([
                'requestConfig' => [
                    'format' => Client::FORMAT_XML
                ],
                'responseConfig' => [
                    'format' => Client::FORMAT_XML
                ],
            ]);
        }
        return $this->_httpClient;
    }
343064
public function make()
    {
        $this->setDefaultHeaders();

        $startTime = microtime(true);
        $result = $this->httpClient->request($this->getMethod(), $this->getURL(), $this->getPayload());
        $endTime = microtime(true);

        $this->response = new Response();
        $this->response->setExecutionTime(round(($endTime - $startTime), 5))
            ->setStatusCode($result->getStatusCode());

        // set the request ID for remote debugging if it is present            
        if (!empty(($requestID = $result->getHeader('X-Moltin-Request-Id')))) {
            $this->response->setRequestID($requestID[0]);
        }

        $body = json_decode($result->getBody());
        $this->response->setRaw($body)->parse();

        return $this;
    }
340662
protected function createClient()
	{
		$resource = Route::input( 'resource' );
		$related = Route::input( 'related', Input::get( 'related' ) );

		$aimeos = app( 'aimeos' )->get();
		$tmplPaths = $aimeos->getCustomPaths( 'client/jsonapi/templates' );

		$context = app( 'aimeos.context' )->get();
		$langid = $context->getLocale()->getLanguageId();

		$context->setView( app( 'aimeos.view' )->create( $context, $tmplPaths, $langid ) );

		return \Aimeos\Client\JsonApi::create( $context, $resource . '/' . $related );
	}
1062205
public static WebsocketClientTransport create(TcpClient client) {
    Objects.requireNonNull(client, "client must not be null");

    return create(HttpClient.from(client), DEFAULT_PATH);
  }
574680
public function create()
	{
		$view = $this->addViewData( $this->getView() );
		$siteid = $this->getContext()->getLocale()->getSiteId();
		$data = $view->get( 'mediaData', [] );

		foreach( $data as $index => $entry )
		{
			foreach( $view->value( $entry, 'property', [] ) as $idx => $y ) {
				$data[$index]['property'][$idx]['service.lists.siteid'] = $siteid;
			}
		}

		$view->propertyData = $data;
		$view->propertyBody = '';

		foreach( $this->getSubClients() as $client ) {
			$view->propertyBody .= $client->create();
		}

		return $this->render( $view );
	}
995692
@SneakyThrows
    public HttpClient createHttpClient() {
        val builder = new StdHttpClient.Builder()
            .url(couchDbProperties.getUrl())
            .maxConnections(couchDbProperties.getMaxConnections())
            .maxCacheEntries(couchDbProperties.getMaxCacheEntries())
            .connectionTimeout(couchDbProperties.getConnectionTimeout())
            .socketTimeout(couchDbProperties.getSocketTimeout())
            .enableSSL(couchDbProperties.isEnableSSL())
            .relaxedSSLSettings(couchDbProperties.isRelaxedSSLSettings())
            .caching(couchDbProperties.isCaching())
            .maxObjectSizeBytes(couchDbProperties.getMaxObjectSizeBytes())
            .useExpectContinue(couchDbProperties.isUseExpectContinue())
            .cleanupIdleConnections(couchDbProperties.isCleanupIdleConnections());


        if (StringUtils.isNotBlank(couchDbProperties.getProxyHost())) {
            builder.proxy(couchDbProperties.getProxyHost());

            if (couchDbProperties.getProxyPort() > 0) {
                builder.proxyPort(couchDbProperties.getProxyPort());
                LOGGER.info("CouchDb proxy settings enabled [{}]:[{}]", couchDbProperties.getProxyHost(), couchDbProperties.getProxyPort());
            } else {
                LOGGER.debug("Proxy port not set for host [{}] clearing proxy host.", couchDbProperties.getProxyHost());
                builder.proxy(null);
            }
        }

        if (StringUtils.isNotBlank(couchDbProperties.getUsername())) {
            builder.username(couchDbProperties.getUsername());
        }

        if (StringUtils.isNotBlank(couchDbProperties.getPassword())) {
            builder.password(couchDbProperties.getPassword());
        }

        val client = builder.build();
        LOGGER.debug("Client created: [{}]", client);
        return client;
    }
1199707
public static CloseableHttpClient newHttpClient() {
        final SocketConfig socketConfig = SocketConfig.custom()
                .setSoKeepAlive(Boolean.TRUE).setTcpNoDelay(Boolean.TRUE)
                .setSoTimeout(SOCKET_TIMEOUT_MS).build();

        final PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager();
        manager.setDefaultMaxPerRoute(MAX_HOSTS);
        manager.setMaxTotal(MAX_HOSTS);
        manager.setDefaultSocketConfig(socketConfig);

        final RequestConfig requestConfig = RequestConfig.custom()
                .setConnectTimeout(CONNECTION_TIMEOUT_MS)
                .setCookieSpec(CookieSpecs.IGNORE_COOKIES)
                .setStaleConnectionCheckEnabled(Boolean.FALSE)
                .setSocketTimeout(SOCKET_TIMEOUT_MS).build();

        final CloseableHttpClient client = HttpClients
                .custom()
                .disableRedirectHandling()
                .setConnectionManager(manager)
                .setDefaultRequestConfig(requestConfig)
                .setConnectionReuseStrategy(
                        new DefaultConnectionReuseStrategy())
                .setConnectionBackoffStrategy(new DefaultBackoffStrategy())
                .setRetryHandler(
                        new DefaultHttpRequestRetryHandler(MAX_RETRIES, false))
                .setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy())
                .build();
        return client;
    }
918237
protected T build() {
        final T instance;
        try {
            instance = build(connection(), maxContentLength(),
                                     isValidateHttpHeaders(), isPropagateSettings());
        } catch (Throwable t) {
            throw new IllegalStateException("failed to create a new InboundHttp2ToHttpAdapter", t);
        }
        connection.addListener(instance);
        return instance;
    }
1247211
public function getHttpClient()
    {
        if (!is_null($this->httpClient)) {
            return $this->httpClient;
        }

        return $this->httpClient = new Client([
            'base_uri' => $this->storageUrl(),
            'headers' => [
                'X-Auth-Token' => $this->token(),
            ],
        ]);
    }
859465
private function getSoapClient()
    {
        if (null === $this->soapClient) {
            $this->soapClient = new \SoapClient(
                $this->wsdl,
                array(
                    'classmap' => $this->classmap,
                    'user_agent' => 'Mozilla', // the request fails unless a (dummy) user agent is specified
                    'exceptions' => true,
                )
            );
        }

        return $this->soapClient;
    }
1035719
public function createClient()
	{
		$client = ClientBuilder::fromConfig($this->environment->all());

		$this->setClient($client);
	}