当前位置: 首页>>代码示例>>Java>>正文


Java HttpVersion.HTTP_2属性代码示例

本文整理汇总了Java中io.vertx.core.http.HttpVersion.HTTP_2属性的典型用法代码示例。如果您正苦于以下问题:Java HttpVersion.HTTP_2属性的具体用法?Java HttpVersion.HTTP_2怎么用?Java HttpVersion.HTTP_2使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在io.vertx.core.http.HttpVersion的用法示例。


在下文中一共展示了HttpVersion.HTTP_2属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createHttpClientOptions

@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,代码行数:17,代码来源:WebsocketClientPool.java

示例2: createHttpClientOptions

@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,代码行数:25,代码来源:HttpClientPool.java

示例3: testPrivateMethodCreateHttpClientOptions

@Test
public void testPrivateMethodCreateHttpClientOptions() {
  MicroserviceFactory microserviceFactory = new MicroserviceFactory();
  Microservice microservice = microserviceFactory.create("app", "ms");
  oClient.registerMicroservice(microservice);
  oClient.registerMicroserviceInstance(microservice.getInstance());
  new MockUp<ServiceRegistryConfig>() {
    @Mock
    public HttpVersion getHttpVersion() {
      return HttpVersion.HTTP_2;
    }

    @Mock
    public boolean isSsl() {
      return true;
    }
  };
  try {
    oClient.init();
    HttpClientOptions httpClientOptions = Deencapsulation.invoke(oClient, "createHttpClientOptions");
    Assert.assertNotNull(httpClientOptions);
    Assert.assertEquals(80, httpClientOptions.getDefaultPort());
  } catch (Exception e) {
    Assert.assertNotNull(e);
  }
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:26,代码来源:TestServiceRegistryClientImpl.java

示例4: testHttpClientPool

@Test
public void testHttpClientPool() {
  new MockUp<ServiceRegistryConfig>() {
    @Mock
    public HttpVersion getHttpVersion() {
      return HttpVersion.HTTP_2;
    }

    @Mock
    public boolean isSsl() {
      return true;
    }
  };
  HttpClientPool.INSTANCE.create();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:15,代码来源:TestClientPool.java

示例5: testWebsocketClientPool

@Test
public void testWebsocketClientPool() {
  new MockUp<ServiceRegistryConfig>() {
    @Mock
    public HttpVersion getHttpVersion() {
      return HttpVersion.HTTP_2;
    }

    @Mock
    public boolean isSsl() {
      return true;
    }
  };
  WebsocketClientPool.INSTANCE.create();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:15,代码来源:TestClientPool.java


注:本文中的io.vertx.core.http.HttpVersion.HTTP_2属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。