本文整理匯總了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);
}