Java Code Examples for io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior#NO_ADVERTISE
The following examples show how to use
io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior#NO_ADVERTISE .
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: TlsUtil.java From nitmproxy with MIT License | 6 votes |
private static ApplicationProtocolConfig applicationProtocolConfig(NitmProxyConfig config, boolean http2) { if (http2) { return new ApplicationProtocolConfig( Protocol.ALPN, SelectorFailureBehavior.NO_ADVERTISE, SelectedListenerFailureBehavior.ACCEPT, ApplicationProtocolNames.HTTP_2, ApplicationProtocolNames.HTTP_1_1); } else { return new ApplicationProtocolConfig( Protocol.ALPN, SelectorFailureBehavior.NO_ADVERTISE, SelectedListenerFailureBehavior.ACCEPT, ApplicationProtocolNames.HTTP_1_1); } }
Example 2
Source File: Http2Server.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
private static SslContext configureTLS() throws CertificateException, SSLException { SelfSignedCertificate ssc = new SelfSignedCertificate(); ApplicationProtocolConfig apn = new ApplicationProtocolConfig( Protocol.ALPN, // NO_ADVERTISE is currently the only mode supported by both OpenSsl and JDK providers. SelectorFailureBehavior.NO_ADVERTISE, // ACCEPT is currently the only mode supported by both OpenSsl and JDK providers. SelectedListenerFailureBehavior.ACCEPT, ApplicationProtocolNames.HTTP_2, ApplicationProtocolNames.HTTP_1_1); return SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey(), null) .ciphers(CIPHERS, SupportedCipherSuiteFilter.INSTANCE) .applicationProtocolConfig(apn).build(); }
Example 3
Source File: OpenSslEngineTest.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
private static ApplicationProtocolConfig acceptingNegotiator(Protocol protocol, String... supportedProtocols) { return new ApplicationProtocolConfig(protocol, SelectorFailureBehavior.NO_ADVERTISE, SelectedListenerFailureBehavior.ACCEPT, supportedProtocols); }
Example 4
Source File: JdkSslEngineTest.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
private static ApplicationProtocolConfig acceptingNegotiator(Protocol protocol, String... supportedProtocols) { return new ApplicationProtocolConfig(protocol, SelectorFailureBehavior.NO_ADVERTISE, SelectedListenerFailureBehavior.ACCEPT, supportedProtocols); }
Example 5
Source File: NettySubstitutions.java From quarkus with Apache License 2.0 | 4 votes |
@Substitute static JdkApplicationProtocolNegotiator toNegotiator(ApplicationProtocolConfig config, boolean isServer) { if (config == null) { return (JdkApplicationProtocolNegotiator) (Object) Target_io_netty_handler_ssl_JdkDefaultApplicationProtocolNegotiator.INSTANCE; } switch (config.protocol()) { case NONE: return (JdkApplicationProtocolNegotiator) (Object) Target_io_netty_handler_ssl_JdkDefaultApplicationProtocolNegotiator.INSTANCE; case ALPN: if (isServer) { // GRAAL RC9 bug: https://github.com/oracle/graal/issues/813 // switch(config.selectorFailureBehavior()) { // case FATAL_ALERT: // return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); // case NO_ADVERTISE: // return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); // default: // throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") // .append(config.selectorFailureBehavior()).append(" failure behavior").toString()); // } SelectorFailureBehavior behavior = config.selectorFailureBehavior(); if (behavior == SelectorFailureBehavior.FATAL_ALERT) return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); else if (behavior == SelectorFailureBehavior.NO_ADVERTISE) return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); else { throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectorFailureBehavior()).append(" failure behavior").toString()); } } else { switch (config.selectedListenerFailureBehavior()) { case ACCEPT: return new JdkAlpnApplicationProtocolNegotiator(false, config.supportedProtocols()); case FATAL_ALERT: return new JdkAlpnApplicationProtocolNegotiator(true, config.supportedProtocols()); default: throw new UnsupportedOperationException(new StringBuilder("JDK provider does not support ") .append(config.selectedListenerFailureBehavior()).append(" failure behavior").toString()); } } default: throw new UnsupportedOperationException( new StringBuilder("JDK provider does not support ").append(config.protocol()).append(" protocol") .toString()); } }