use of io.vertx.core.http.HttpClientOptions in project incubator-servicecomb-java-chassis by apache.
the class TestVertxTLSBuilder method testbuildClientOptionsBaseAuthPeerFalse.
@Test
public void testbuildClientOptionsBaseAuthPeerFalse() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
new MockUp<SSLOption>() {
@Mock
public boolean isAuthPeer() {
return false;
}
};
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 TestVertxTLSBuilder method testbuildClientOptionsBaseSTORE_JKS.
@Test
public void testbuildClientOptionsBaseSTORE_JKS() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
new MockUp<SSLOption>() {
@Mock
public String getKeyStoreType() {
return "JKS";
}
};
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 RestTransportClient method init.
public void init(Vertx vertx) throws Exception {
HttpClientOptions httpClientOptions = createHttpClientOptions();
clientMgr = new ClientPoolManager<>(vertx, new HttpClientPoolFactory(httpClientOptions));
DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(clientMgr, TransportClientConfig.getThreadCount());
VertxUtils.blockDeploy(vertx, ClientVerticle.class, deployOptions);
}
use of io.vertx.core.http.HttpClientOptions in project incubator-servicecomb-java-chassis by apache.
the class ConfigCenterClient method createHttpClientOptions.
private HttpClientOptions createHttpClientOptions() {
HttpClientOptions httpClientOptions = new HttpClientOptions();
if (ConfigCenterConfig.INSTANCE.isProxyEnable()) {
ProxyOptions proxy = new ProxyOptions().setHost(ConfigCenterConfig.INSTANCE.getProxyHost()).setPort(ConfigCenterConfig.INSTANCE.getProxyPort()).setUsername(ConfigCenterConfig.INSTANCE.getProxyUsername()).setPassword(ConfigCenterConfig.INSTANCE.getProxyPasswd());
httpClientOptions.setProxyOptions(proxy);
}
httpClientOptions.setConnectTimeout(CONFIG_CENTER_CONFIG.getConnectionTimeout());
if (this.memberDiscovery.getConfigServer().toLowerCase().startsWith("https")) {
LOGGER.debug("config 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;
}
use of io.vertx.core.http.HttpClientOptions in project vertx-web by vert-x3.
the class OpenAPI3RouterFactoryTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
// Have to stop default server of WebTestBase
stopServer();
client = vertx.createHttpClient(new HttpClientOptions().setDefaultPort(8080));
}
Aggregations