Java Code Examples for io.netty.handler.ssl.ApplicationProtocolConfig.Protocol#ALPN

The following examples show how to use io.netty.handler.ssl.ApplicationProtocolConfig.Protocol#ALPN . 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 vote down vote up
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 vote down vote up
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: JdkSslEngineTest.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
Protocol protocol() {
    return Protocol.ALPN;
}
 
Example 4
Source File: JdkSslEngineTest.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
Protocol protocol() {
    return Protocol.ALPN;
}
 
Example 5
Source File: JdkSslEngineTest.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
Protocol protocol() {
    return Protocol.ALPN;
}