Search in sources :

Example 11 with SSLOption

use of io.servicecomb.foundation.ssl.SSLOption 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);
}
Also used : MockUp(mockit.MockUp) SSLOption(io.servicecomb.foundation.ssl.SSLOption) SSLCustom(io.servicecomb.foundation.ssl.SSLCustom) HttpClientOptions(io.vertx.core.http.HttpClientOptions) Test(org.junit.Test)

Example 12 with SSLOption

use of io.servicecomb.foundation.ssl.SSLOption 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;
}
Also used : TcpClientConfig(io.servicecomb.foundation.vertx.client.tcp.TcpClientConfig) SSLOptionFactory(io.servicecomb.foundation.ssl.SSLOptionFactory) SSLOption(io.servicecomb.foundation.ssl.SSLOption) SSLCustom(io.servicecomb.foundation.ssl.SSLCustom)

Example 13 with SSLOption

use of io.servicecomb.foundation.ssl.SSLOption in project java-chassis by ServiceComb.

the class AbstractClientPool method buildSecureClientOptions.

protected void buildSecureClientOptions(HttpClientOptions httpClientOptions) {
    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);
}
Also used : SSLOptionFactory(io.servicecomb.foundation.ssl.SSLOptionFactory) SSLOption(io.servicecomb.foundation.ssl.SSLOption) SSLCustom(io.servicecomb.foundation.ssl.SSLCustom)

Aggregations

SSLCustom (io.servicecomb.foundation.ssl.SSLCustom)13 SSLOption (io.servicecomb.foundation.ssl.SSLOption)13 Test (org.junit.Test)8 HttpClientOptions (io.vertx.core.http.HttpClientOptions)7 SSLOptionFactory (io.servicecomb.foundation.ssl.SSLOptionFactory)5 MockUp (mockit.MockUp)4 HttpServerOptions (io.vertx.core.http.HttpServerOptions)3 TcpClientConfig (io.servicecomb.foundation.vertx.client.tcp.TcpClientConfig)1 NetServer (io.vertx.core.net.NetServer)1 NetServerOptions (io.vertx.core.net.NetServerOptions)1 InetSocketAddress (java.net.InetSocketAddress)1