本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}