use of io.servicecomb.foundation.ssl.SSLCustom in project java-chassis by ServiceComb.
the class TestVertxTLSBuilder method testbuildClientOptionsBase.
@Test
public void testbuildClientOptionsBase() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.isTrustAll(), true);
}
use of io.servicecomb.foundation.ssl.SSLCustom in project java-chassis by ServiceComb.
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.servicecomb.foundation.ssl.SSLCustom in project java-chassis by ServiceComb.
the class HighwayClient method createTcpClientConfig.
private TcpClientConfig createTcpClientConfig() {
TcpClientConfig tcpClientConfig = new TcpClientConfig();
tcpClientConfig.setRequestTimeoutMillis(AbstractTransport.getRequestTimeout());
tcpClientConfig.setTcpLogin(this);
if (this.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.buildClientOptionsBase(sslOption, sslCustom, tcpClientConfig);
}
return tcpClientConfig;
}
Aggregations