List of usage examples for io.vertx.core.http HttpClientOptions setProtocolVersion
public HttpClientOptions setProtocolVersion(HttpVersion protocolVersion)
From source file:io.servicecomb.serviceregistry.client.http.HttpClientPool.java
License:Apache License
@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 (ver == HttpVersion.HTTP_2) { LOGGER.debug("service center client protocol version is HTTP/2"); httpClientOptions.setHttp2ClearTextUpgrade(false); }/*from w ww.jav a 2 s. co m*/ if (ServiceRegistryConfig.INSTANCE.isSsl()) { LOGGER.debug("service center client performs requests over TLS"); buildSecureClientOptions(httpClientOptions); } return httpClientOptions; }
From source file:io.servicecomb.serviceregistry.client.http.WebsocketClientPool.java
License:Apache License
@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); }//from w ww . ja v a2 s . c om if (ServiceRegistryConfig.INSTANCE.isSsl()) { LOGGER.debug("service center ws client performs requests over TLS"); buildSecureClientOptions(httpClientOptions); } return httpClientOptions; }
From source file:org.apache.servicecomb.serviceregistry.client.http.HttpClientPool.java
License:Apache License
@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); }//from w w w . j a v a2s . co m 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; }
From source file:org.apache.servicecomb.serviceregistry.client.http.WebsocketClientPool.java
License:Apache License
@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); }//from ww w . j a v a 2s .c o m if (ServiceRegistryConfig.INSTANCE.isSsl()) { LOGGER.debug("service center ws client performs requests over TLS"); VertxTLSBuilder.buildHttpClientOptions(SSL_KEY, httpClientOptions); } return httpClientOptions; }