ALPN/NPN Examples Not using failure behavior compatible with all SslProviders
Motivation: Examples that are using ALPN/NPN are using a failure mode which is not supported by the JDK SslProvider. The examples fail to run and throw an exception if the JDK SslProvider is used. Modifications: - Use SelectorFailureBehavior.NO_ADVERTISE - Use SelectedListenerFailureBehavior.ACCEPT Result: Examples can be run with both OpenSsl and JDK SslProviders.
This commit is contained in:
parent
2927cdd504
commit
2dd59e44b7
@ -73,8 +73,10 @@ public final class Http2Client {
|
|||||||
.trustManager(InsecureTrustManagerFactory.INSTANCE)
|
.trustManager(InsecureTrustManagerFactory.INSTANCE)
|
||||||
.applicationProtocolConfig(new ApplicationProtocolConfig(
|
.applicationProtocolConfig(new ApplicationProtocolConfig(
|
||||||
Protocol.ALPN,
|
Protocol.ALPN,
|
||||||
SelectorFailureBehavior.CHOOSE_MY_LAST_PROTOCOL,
|
// NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK providers.
|
||||||
SelectedListenerFailureBehavior.CHOOSE_MY_LAST_PROTOCOL,
|
SelectorFailureBehavior.NO_ADVERTISE,
|
||||||
|
// ACCEPT is currently the only mode supported by both OpenSsl and JDK providers.
|
||||||
|
SelectedListenerFailureBehavior.ACCEPT,
|
||||||
SelectedProtocol.HTTP_2.protocolName(),
|
SelectedProtocol.HTTP_2.protocolName(),
|
||||||
SelectedProtocol.HTTP_1_1.protocolName()))
|
SelectedProtocol.HTTP_1_1.protocolName()))
|
||||||
.build();
|
.build();
|
||||||
|
@ -60,8 +60,10 @@ public final class Http2Server {
|
|||||||
.ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
|
.ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE)
|
||||||
.applicationProtocolConfig(new ApplicationProtocolConfig(
|
.applicationProtocolConfig(new ApplicationProtocolConfig(
|
||||||
Protocol.ALPN,
|
Protocol.ALPN,
|
||||||
SelectorFailureBehavior.CHOOSE_MY_LAST_PROTOCOL,
|
// NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK providers.
|
||||||
SelectedListenerFailureBehavior.CHOOSE_MY_LAST_PROTOCOL,
|
SelectorFailureBehavior.NO_ADVERTISE,
|
||||||
|
// ACCEPT is currently the only mode supported by both OpenSsl and JDK providers.
|
||||||
|
SelectedListenerFailureBehavior.ACCEPT,
|
||||||
SelectedProtocol.HTTP_2.protocolName(),
|
SelectedProtocol.HTTP_2.protocolName(),
|
||||||
SelectedProtocol.HTTP_1_1.protocolName()))
|
SelectedProtocol.HTTP_1_1.protocolName()))
|
||||||
.build();
|
.build();
|
||||||
|
@ -32,7 +32,6 @@ import io.netty.handler.ssl.ApplicationProtocolConfig;
|
|||||||
import io.netty.handler.ssl.ApplicationProtocolConfig.Protocol;
|
import io.netty.handler.ssl.ApplicationProtocolConfig.Protocol;
|
||||||
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectedListenerFailureBehavior;
|
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectedListenerFailureBehavior;
|
||||||
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior;
|
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior;
|
||||||
import io.netty.handler.ssl.IdentityCipherSuiteFilter;
|
|
||||||
import io.netty.handler.ssl.SslContext;
|
import io.netty.handler.ssl.SslContext;
|
||||||
import io.netty.handler.ssl.SslContextBuilder;
|
import io.netty.handler.ssl.SslContextBuilder;
|
||||||
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
|
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
|
||||||
@ -62,8 +61,10 @@ public final class SpdyClient {
|
|||||||
.trustManager(InsecureTrustManagerFactory.INSTANCE)
|
.trustManager(InsecureTrustManagerFactory.INSTANCE)
|
||||||
.applicationProtocolConfig(new ApplicationProtocolConfig(
|
.applicationProtocolConfig(new ApplicationProtocolConfig(
|
||||||
Protocol.NPN,
|
Protocol.NPN,
|
||||||
SelectorFailureBehavior.CHOOSE_MY_LAST_PROTOCOL,
|
// NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK providers.
|
||||||
SelectedListenerFailureBehavior.CHOOSE_MY_LAST_PROTOCOL,
|
SelectorFailureBehavior.NO_ADVERTISE,
|
||||||
|
// ACCEPT is currently the only mode supported by both OpenSsl and JDK providers.
|
||||||
|
SelectedListenerFailureBehavior.ACCEPT,
|
||||||
SelectedProtocol.SPDY_3_1.protocolName(),
|
SelectedProtocol.SPDY_3_1.protocolName(),
|
||||||
SelectedProtocol.HTTP_1_1.protocolName()))
|
SelectedProtocol.HTTP_1_1.protocolName()))
|
||||||
.build();
|
.build();
|
||||||
|
@ -28,7 +28,6 @@ import io.netty.handler.ssl.ApplicationProtocolConfig;
|
|||||||
import io.netty.handler.ssl.ApplicationProtocolConfig.Protocol;
|
import io.netty.handler.ssl.ApplicationProtocolConfig.Protocol;
|
||||||
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectedListenerFailureBehavior;
|
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectedListenerFailureBehavior;
|
||||||
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior;
|
import io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior;
|
||||||
import io.netty.handler.ssl.IdentityCipherSuiteFilter;
|
|
||||||
import io.netty.handler.ssl.SslContext;
|
import io.netty.handler.ssl.SslContext;
|
||||||
import io.netty.handler.ssl.SslContextBuilder;
|
import io.netty.handler.ssl.SslContextBuilder;
|
||||||
import io.netty.handler.ssl.util.SelfSignedCertificate;
|
import io.netty.handler.ssl.util.SelfSignedCertificate;
|
||||||
@ -61,8 +60,10 @@ public final class SpdyServer {
|
|||||||
SslContext sslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey())
|
SslContext sslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey())
|
||||||
.applicationProtocolConfig(new ApplicationProtocolConfig(
|
.applicationProtocolConfig(new ApplicationProtocolConfig(
|
||||||
Protocol.NPN,
|
Protocol.NPN,
|
||||||
SelectorFailureBehavior.CHOOSE_MY_LAST_PROTOCOL,
|
// NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK providers.
|
||||||
SelectedListenerFailureBehavior.CHOOSE_MY_LAST_PROTOCOL,
|
SelectorFailureBehavior.NO_ADVERTISE,
|
||||||
|
// ACCEPT is currently the only mode supported by both OpenSsl and JDK providers.
|
||||||
|
SelectedListenerFailureBehavior.ACCEPT,
|
||||||
SelectedProtocol.SPDY_3_1.protocolName(),
|
SelectedProtocol.SPDY_3_1.protocolName(),
|
||||||
SelectedProtocol.HTTP_1_1.protocolName()))
|
SelectedProtocol.HTTP_1_1.protocolName()))
|
||||||
.build();
|
.build();
|
||||||
|
Loading…
Reference in New Issue
Block a user