use of io.vertx.core.http.HttpClientOptions in project incubator-servicecomb-java-chassis by apache.
the class TestVertxTLSBuilder method testbuildClientOptionsBaseSTORE_PKCS12.
@Test
public void testbuildClientOptionsBaseSTORE_PKCS12() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
new MockUp<SSLOption>() {
@Mock
public String getTrustStoreType() {
return "PKCS12";
}
};
VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.isTrustAll(), true);
}
use of io.vertx.core.http.HttpClientOptions in project incubator-servicecomb-java-chassis by apache.
the class TestServiceRegistryClientImpl method 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);
}
}
use of io.vertx.core.http.HttpClientOptions in project incubator-servicecomb-java-chassis by apache.
the class TestRestTransportClient method testCreateHttpClientOptions.
@Test
public void testCreateHttpClientOptions() {
HttpClientOptions obj = (HttpClientOptions) Deencapsulation.invoke(instance, "createHttpClientOptions");
Assert.assertNotNull(obj);
}
use of io.vertx.core.http.HttpClientOptions in project incubator-servicecomb-java-chassis by apache.
the class RestTransportClient method createHttpClientOptions.
private static HttpClientOptions createHttpClientOptions() {
HttpClientOptions httpClientOptions = new HttpClientOptions();
httpClientOptions.setMaxPoolSize(TransportClientConfig.getConnectionMaxPoolSize());
httpClientOptions.setIdleTimeout(TransportClientConfig.getConnectionIdleTimeoutInSeconds());
httpClientOptions.setKeepAlive(TransportClientConfig.getConnectionKeepAlive());
httpClientOptions.setTryUseCompression(TransportClientConfig.getConnectionCompression());
VertxTLSBuilder.buildHttpClientOptions(SSL_KEY, httpClientOptions);
return httpClientOptions;
}
use of io.vertx.core.http.HttpClientOptions in project incubator-servicecomb-java-chassis by apache.
the class ConfigCenterClient method deployConfigClient.
private void deployConfigClient() throws InterruptedException {
VertxOptions vertxOptions = new VertxOptions();
vertxOptions.setAddressResolverOptions(AddressResolverConfig.getAddressResover(SSL_KEY, ConfigCenterConfig.INSTANCE.getConcurrentCompositeConfiguration()));
Vertx vertx = VertxUtils.getOrCreateVertxByName("config-center", vertxOptions);
HttpClientOptions httpClientOptions = createHttpClientOptions();
clientMgr = new ClientPoolManager<>(vertx, new HttpClientPoolFactory(httpClientOptions));
DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(clientMgr, 1);
VertxUtils.blockDeploy(vertx, ClientVerticle.class, deployOptions);
}
Aggregations