use of org.apache.servicecomb.foundation.ssl.SSLOption in project java-chassis by ServiceComb.
the class TestVertxTLSBuilder method testbuildClientOptionsBaseFileNull.
@Test
public void testbuildClientOptionsBaseFileNull() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
option.setKeyStore(null);
option.setTrustStore(null);
option.setCrl(null);
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 org.apache.servicecomb.foundation.ssl.SSLOption in project java-chassis by ServiceComb.
the class TestVertxTLSBuilder method testbuildHttpClientOptions.
@Test
public void testbuildHttpClientOptions() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
VertxTLSBuilder.buildHttpClientOptions(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.isTrustAll(), true);
}
use of org.apache.servicecomb.foundation.ssl.SSLOption in project java-chassis by ServiceComb.
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.SSLOption in project java-chassis by ServiceComb.
the class RestServerVerticle method createDefaultHttpServerOptions.
private HttpServerOptions createDefaultHttpServerOptions() {
HttpServerOptions serverOptions = new HttpServerOptions();
serverOptions.setIdleTimeout(TransportConfig.getConnectionIdleTimeoutInSeconds());
serverOptions.setCompressionSupported(TransportConfig.getCompressed());
serverOptions.setMaxHeaderSize(TransportConfig.getMaxHeaderSize());
serverOptions.setMaxFormAttributeSize(TransportConfig.getMaxFormAttributeSize());
serverOptions.setCompressionLevel(TransportConfig.getCompressionLevel());
serverOptions.setMaxChunkSize(TransportConfig.getMaxChunkSize());
serverOptions.setDecompressionSupported(TransportConfig.getDecompressionSupported());
serverOptions.setDecoderInitialBufferSize(TransportConfig.getDecoderInitialBufferSize());
serverOptions.setHttp2ConnectionWindowSize(TransportConfig.getHttp2ConnectionWindowSize());
serverOptions.setMaxInitialLineLength(TransportConfig.getMaxInitialLineLength());
if (endpointObject.isHttp2Enabled()) {
serverOptions.setUseAlpn(TransportConfig.getUseAlpn()).setInitialSettings(new Http2Settings().setPushEnabled(TransportConfig.getPushEnabled()).setMaxConcurrentStreams(TransportConfig.getMaxConcurrentStreams()).setHeaderTableSize(TransportConfig.getHttp2HeaderTableSize()).setInitialWindowSize(TransportConfig.getInitialWindowSize()).setMaxFrameSize(TransportConfig.getMaxFrameSize()).setMaxHeaderListSize(TransportConfig.getMaxHeaderListSize()));
}
if (endpointObject.isSslEnabled()) {
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.buildNetServerOptions(sslOption, sslCustom, serverOptions);
}
return serverOptions;
}
Aggregations