Example usage for io.vertx.core.http HttpClientOptions setHttp2ClearTextUpgrade

List of usage examples for io.vertx.core.http HttpClientOptions setHttp2ClearTextUpgrade

Introduction

In this page you can find the example usage for io.vertx.core.http HttpClientOptions setHttp2ClearTextUpgrade.

Prototype

public HttpClientOptions setHttp2ClearTextUpgrade(boolean value) 

Source Link

Document

Set to true when an <i>h2c</i> connection is established using an HTTP/1.1 upgrade request, and false when an <i>h2c</i> connection is established directly (with prior knowledge).

Usage

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  www.  jav a  2 s  .com*/
    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 .  j av a2s . c o  m
    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  av a 2  s  . c o  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);
    }/*ww w . ja v a  2 s.c  om*/
    if (ServiceRegistryConfig.INSTANCE.isSsl()) {
        LOGGER.debug("service center ws client performs requests over TLS");
        VertxTLSBuilder.buildHttpClientOptions(SSL_KEY, httpClientOptions);
    }
    return httpClientOptions;
}