Clone
Daniel Bevenius
committed
on 06 Nov 14
Make SslProvider.JDK the default provider for http2 examples using ALPN.
Motivation:
When running the http2 example no SslProvider is specif… Show more
Make SslProvider.JDK the default provider for http2 examples using ALPN.

Motivation:

When running the http2 example no SslProvider is specified when calling

SslContext.newServerContext. This may lead to the provider being

determined depending on the availabilty of OpenSsl. But as far as I can

tell the OpenSslServerContext does not support APLN, which is the

protocol configured in the example.

This produces the following error when running the example:

Exception in thread "main" java.lang.UnsupportedOperationException:

OpenSSL provider does not support ALPN protocol

io.netty.handler.ssl.OpenSslServerContext.toNegotiator(OpenSslServerContext.java:391)

io.netty.handler.ssl.OpenSslServerContext.<init>(OpenSslServerContext.java:117)

io.netty.handler.ssl.SslContext.newServerContext(SslContext.java:238)

io.netty.handler.ssl.SslContext.newServerContext(SslContext.java:184)

io.netty.handler.ssl.SslContext.newServerContext(SslContext.java:124)

io.netty.example.http2.server.Http2Server.main(Http2Server.java:51)

Modifications:

Force SslProvider.JDK when creating the SslContext since the

example is using APLN.

Result:

There is no longer an error if OpenSsl is supported on the platform in

use.

Show less