当前位置: 首页>>代码示例>>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;未经允许,请勿转载。