io.vertx.core.net.JdkSSLEngineOptions Java Examples

The following examples show how to use io.vertx.core.net.JdkSSLEngineOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Http2TestCase.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Test
public void testHttp2EnabledSsl() throws ExecutionException, InterruptedException {
    Assumptions.assumeTrue(JdkSSLEngineOptions.isAlpnAvailable()); //don't run on JDK8
    Vertx vertx = Vertx.vertx();
    try {
        WebClientOptions options = new WebClientOptions()
                .setUseAlpn(true)
                .setProtocolVersion(HttpVersion.HTTP_2)
                .setSsl(true)
                .setKeyStoreOptions(
                        new JksOptions().setPath("src/test/resources/client-keystore.jks").setPassword("password"))
                .setTrustStoreOptions(
                        new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password"));

        WebClient client = WebClient.create(vertx, options);
        int port = sslUrl.getPort();

        runTest(client, port);

    } finally {
        vertx.close();
    }
}
 
Example #2
Source File: Http2Test.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Test
public void testHttp2EnabledSsl() throws ExecutionException, InterruptedException {
    Assumptions.assumeTrue(JdkSSLEngineOptions.isAlpnAvailable()); //don't run on JDK8
    WebClientOptions options = new WebClientOptions()
            .setUseAlpn(true)
            .setProtocolVersion(HttpVersion.HTTP_2)
            .setSsl(true)
            .setTrustAll(true);
    WebClient client = WebClient.create(VertxCoreRecorder.getVertx().get(), options);
    int port = sslUrl.getPort();

    runTest(client, port);
}
 
Example #3
Source File: HttpsGatewayVerticle.java    From apiman with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Future<Void> startFuture) {
    super.start(startFuture);

    HttpApiFactory.init(engine.getApiRequestPathParser());

    InheritingHttpServerOptions httpsServerOptions = new InheritingHttpServerOptions();
    httpsServerOptions
        .setSsl(true)
        .setKeyStoreOptions(
                new JksOptions()
                    .setPath(apimanConfig.getKeyStore())
                    .setPassword(apimanConfig.getKeyStorePassword())
                )
        .setTrustStoreOptions(
                new JksOptions()
                    .setPath(apimanConfig.getTrustStore())
                    .setPassword(apimanConfig.getTrustStorePassword())
                );
    addAllowedSslTlsProtocols(httpsServerOptions);

    if (JdkSSLEngineOptions.isAlpnAvailable()) {
        httpsServerOptions.setUseAlpn(true);
    }

    // Load any provided configuration into the HttpServerOptions.
    JsonObject httpServerOptionsJson = apimanConfig.getVerticleConfig(verticleType().name())
            .getJsonObject("httpServerOptions", new JsonObject()); //$NON-NLS-1$
    InheritingHttpServerOptionsConverter.fromJson(httpServerOptionsJson, httpsServerOptions);

    vertx.createHttpServer(httpsServerOptions)
        .requestHandler(this::requestHandler)
        .listen(apimanConfig.getPort(VERTICLE_TYPE),
                apimanConfig.getHostname());
}
 
Example #4
Source File: HttpClientComponentImpl.java    From apiman with Apache License 2.0 5 votes vote down vote up
public HttpClientComponentImpl(Vertx vertx, VertxEngineConfig engineConfig, Map<String, String> componentConfig) {
    HttpClientOptions sslOptions = new HttpClientOptions()
            .setSsl(true)
            .setVerifyHost(false)
            .setTrustAll(true); // TODO

    if (JdkSSLEngineOptions.isAlpnAvailable()) {
        sslOptions.setUseAlpn(true);
    }

    this.sslClient = vertx.createHttpClient(sslOptions);
    this.plainClient = vertx.createHttpClient(new HttpClientOptions());
}
 
Example #5
Source File: EchoServerVertx.java    From apiman with Apache License 2.0 5 votes vote down vote up
private HttpServerOptions getHttpServerOptions(String name) {
    HttpServerOptions options = new HttpServerOptions(config().getJsonObject(name, new JsonObject()));
    if (JdkSSLEngineOptions.isAlpnAvailable()) {
        options.setUseAlpn(true);
    }
    return options;
}
 
Example #6
Source File: HttpSslIT.java    From vertx-spring-boot with Apache License 2.0 4 votes vote down vote up
@Bean
public HttpClientOptionsCustomizer clientJdkSslEngineOptionsCustomizer() {
    return options -> options.setSslEngineOptions(new JdkSSLEngineOptions());
}
 
Example #7
Source File: HttpSslIT.java    From vertx-spring-boot with Apache License 2.0 4 votes vote down vote up
@Bean
public HttpServerOptionsCustomizer serverJdkSslEngineOptionsCustomizer() {
    return options -> options.setSslEngineOptions(new JdkSSLEngineOptions());
}
 
Example #8
Source File: DB2ConnectOptions.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
@Override
public DB2ConnectOptions setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) {
  return (DB2ConnectOptions) super.setJdkSslEngineOptions(sslEngineOptions);
}
 
Example #9
Source File: MSSQLConnectOptions.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
@Override
public MSSQLConnectOptions setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) {
  return (MSSQLConnectOptions) super.setJdkSslEngineOptions(sslEngineOptions);
}
 
Example #10
Source File: S3ClientOptions.java    From vertx-s3-client with Apache License 2.0 4 votes vote down vote up
@Override
public S3ClientOptions setJdkSslEngineOptions(final JdkSSLEngineOptions sslEngineOptions) {
    super.setJdkSslEngineOptions(sslEngineOptions);
    return this;
}
 
Example #11
Source File: MailConfig.java    From vertx-mail-client with Apache License 2.0 4 votes vote down vote up
public MailConfig setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) {
  super.setJdkSslEngineOptions(sslEngineOptions);
  return this;
}
 
Example #12
Source File: ProtonServerOptions.java    From vertx-proton with Apache License 2.0 4 votes vote down vote up
@Override
public ProtonServerOptions setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) {
  super.setJdkSslEngineOptions(sslEngineOptions);
  return this;
}
 
Example #13
Source File: ProtonClientOptions.java    From vertx-proton with Apache License 2.0 4 votes vote down vote up
@Override
public ProtonClientOptions setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) {
  super.setJdkSslEngineOptions(sslEngineOptions);
  return this;
}