use of org.apache.servicecomb.foundation.ssl.SSLCustom 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 org.apache.servicecomb.foundation.ssl.SSLCustom 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 org.apache.servicecomb.foundation.ssl.SSLCustom in project incubator-servicecomb-java-chassis by apache.
the class DefaultMonitorDataPublisher method createHttpClientOptions.
private HttpClientOptions createHttpClientOptions() {
HttpClientOptions httpClientOptions = new HttpClientOptions();
if (MonitorConstant.isProxyEnable()) {
ProxyOptions proxy = new ProxyOptions();
proxy.setHost(MonitorConstant.getProxyHost());
proxy.setPort(MonitorConstant.getProxyPort());
proxy.setUsername(MonitorConstant.getProxyUsername());
proxy.setPassword(MonitorConstant.getProxyPasswd());
httpClientOptions.setProxyOptions(proxy);
}
httpClientOptions.setConnectTimeout(MonitorConstant.getConnectionTimeout());
if (MonitorConstant.sslEnabled()) {
SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(SSL_KEY, null);
SSLOption sslOption;
if (factory == null) {
sslOption = SSLOption.buildFromYaml(SSL_KEY);
} else {
sslOption = factory.createSSLOption();
}
SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass());
VertxTLSBuilder.buildHttpClientOptions(sslOption, sslCustom, httpClientOptions);
}
return httpClientOptions;
}
use of org.apache.servicecomb.foundation.ssl.SSLCustom in project incubator-servicecomb-java-chassis by apache.
the class VertxTLSBuilder method buildHttpClientOptions.
public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) {
SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null);
SSLOption sslOption;
if (factory == null) {
sslOption = SSLOption.buildFromYaml(sslKey);
} else {
sslOption = factory.createSSLOption();
}
SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass());
buildHttpClientOptions(sslOption, sslCustom, httpClientOptions);
}
use of org.apache.servicecomb.foundation.ssl.SSLCustom in project incubator-servicecomb-java-chassis by apache.
the class HighwayClient method createTcpClientConfig.
private TcpClientConfig createTcpClientConfig() {
TcpClientConfig tcpClientConfig = new TcpClientConfig();
// global request timeout to be login timeout
tcpClientConfig.setMsLoginTimeout(DynamicPropertyFactory.getInstance().getLongProperty("servicecomb.request.timeout", TcpClientConfig.DEFAULT_LOGIN_TIMEOUT).get());
SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(SSL_KEY, null);
SSLOption sslOption;
if (factory == null) {
sslOption = SSLOption.buildFromYaml(SSL_KEY);
} else {
sslOption = factory.createSSLOption();
}
SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass());
VertxTLSBuilder.buildClientOptionsBase(sslOption, sslCustom, tcpClientConfig);
return tcpClientConfig;
}
Aggregations