當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpClientOptions.setConnectTimeout方法代碼示例

本文整理匯總了Java中io.vertx.core.http.HttpClientOptions.setConnectTimeout方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpClientOptions.setConnectTimeout方法的具體用法?Java HttpClientOptions.setConnectTimeout怎麽用?Java HttpClientOptions.setConnectTimeout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.vertx.core.http.HttpClientOptions的用法示例。


在下文中一共展示了HttpClientOptions.setConnectTimeout方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createHttpClientOptions

import io.vertx.core.http.HttpClientOptions; //導入方法依賴的package包/類
private HttpClientOptions createHttpClientOptions() {
  HttpClientOptions httpClientOptions = new HttpClientOptions();
  httpClientOptions.setConnectTimeout(CONFIG_CENTER_CONFIG.getConnectionTimeout());
  if (serverUri.get(0).toLowerCase().startsWith("https")) {
    LOGGER.debug("service center client performs requests over TLS");
    SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(SSL_KEY,
        ConfigCenterConfig.INSTANCE.getConcurrentCompositeConfiguration());
    SSLOption sslOption;
    if (factory == null) {
      sslOption = SSLOption.buildFromYaml(SSL_KEY,
          ConfigCenterConfig.INSTANCE.getConcurrentCompositeConfiguration());
    } else {
      sslOption = factory.createSSLOption();
    }
    SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass());
    VertxTLSBuilder.buildHttpClientOptions(sslOption, sslCustom, httpClientOptions);
  }
  return httpClientOptions;
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:20,代碼來源:ConfigCenterClient.java

示例2: createHttpClientOptions

import io.vertx.core.http.HttpClientOptions; //導入方法依賴的package包/類
@Override
public HttpClientOptions createHttpClientOptions() {
  HttpVersion ver = ServiceRegistryConfig.INSTANCE.getHttpVersion();
  HttpClientOptions httpClientOptions = new HttpClientOptions();
  httpClientOptions.setProtocolVersion(ver);
  httpClientOptions.setConnectTimeout(ServiceRegistryConfig.INSTANCE.getConnectionTimeout());
  httpClientOptions.setIdleTimeout(ServiceRegistryConfig.INSTANCE.getIdleWatchTimeout());
  if (ver == HttpVersion.HTTP_2) {
    LOGGER.debug("service center ws client protocol version is HTTP/2");
    httpClientOptions.setHttp2ClearTextUpgrade(false);
  }
  if (ServiceRegistryConfig.INSTANCE.isSsl()) {
    LOGGER.debug("service center ws client performs requests over TLS");
    VertxTLSBuilder.buildHttpClientOptions(SSL_KEY, httpClientOptions);
  }
  return httpClientOptions;
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:18,代碼來源:WebsocketClientPool.java

示例3: createHttpClientOptions

import io.vertx.core.http.HttpClientOptions; //導入方法依賴的package包/類
@Override
public HttpClientOptions createHttpClientOptions() {
  HttpVersion ver = ServiceRegistryConfig.INSTANCE.getHttpVersion();
  HttpClientOptions httpClientOptions = new HttpClientOptions();
  httpClientOptions.setProtocolVersion(ver);
  httpClientOptions.setConnectTimeout(ServiceRegistryConfig.INSTANCE.getConnectionTimeout());
  httpClientOptions.setIdleTimeout(ServiceRegistryConfig.INSTANCE.getIdleConnectionTimeout());
  if (ServiceRegistryConfig.INSTANCE.isProxyEnable()) {
    ProxyOptions proxy = new ProxyOptions();
    proxy.setHost(ServiceRegistryConfig.INSTANCE.getProxyHost());
    proxy.setPort(ServiceRegistryConfig.INSTANCE.getProxyPort());
    proxy.setUsername(ServiceRegistryConfig.INSTANCE.getProxyUsername());
    proxy.setPassword(ServiceRegistryConfig.INSTANCE.getProxyPasswd());
    httpClientOptions.setProxyOptions(proxy);
  }
  if (ver == HttpVersion.HTTP_2) {
    LOGGER.debug("service center client protocol version is HTTP/2");
    httpClientOptions.setHttp2ClearTextUpgrade(false);
  }
  if (ServiceRegistryConfig.INSTANCE.isSsl()) {
    LOGGER.debug("service center client performs requests over TLS");
    VertxTLSBuilder.buildHttpClientOptions(SSL_KEY, httpClientOptions);
  }
  return httpClientOptions;
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:26,代碼來源:HttpClientPool.java

示例4: initHttpClient

import io.vertx.core.http.HttpClientOptions; //導入方法依賴的package包/類
private void initHttpClient() {
    HttpClientOptions httpClientOptions = new HttpClientOptions();
    httpClientOptions.setKeepAlive(true);
    httpClientOptions.setPipelining(true);
    httpClientOptions.setConnectTimeout(CONNECT_TIMEOUT);
    httpClientOptions.setMaxWebsocketFrameSize(MAX_WEBSOCKET_FRAME_SIZE_IN_BYTES);
    httpClient = vertx.createHttpClient(httpClientOptions);
}
 
開發者ID:ocraft,項目名稱:ocraft-s2client,代碼行數:9,代碼來源:S2ClientVerticle.java


注:本文中的io.vertx.core.http.HttpClientOptions.setConnectTimeout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。