Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android SSL Exception ALPN Negotiation

See original GitHub issue

The error seems to be related to Android. Browsing the same web page under FF under Linux works. The affected web page is

The problem arises when executing io.netty.handler.ssl.JdkAlpnSslEngine#verifyProtocolSelection.

String protocol = getApplicationProtocol(); returns null. So I’m wondering of it is possible to set a default protocol for the underlying engine, i.e for SSLEngine.getApplicationProtocol ?

I think the code under Android is using the Android BoringSSL implementation. I had to exclude exclude group: 'io.netty', module: 'netty-tcnative-boringssl-static' under Android since the native library is not supported.

2021-04-12 04:35:24.499 23652-23886/com.foobar W/i.n.h.s.ApplicationProtocolNegotiationHandler: [nioEventLoopGroup-3-3] [id: 0xce91b850, L::😕:::37444 ! R:/] TLS handshake null at io.netty.handler.ssl.SslUtils.toSSLHandshakeException( at io.netty.handler.ssl.JdkAlpnSslEngine.verifyProtocolSelection( at io.netty.handler.ssl.JdkAlpnSslEngine.wrap( at io.netty.handler.ssl.SslHandler.wrap( at io.netty.handler.ssl.SslHandler.wrapNonAppData( at io.netty.handler.ssl.SslHandler.unwrap( at io.netty.handler.ssl.SslHandler.decodeJdkCompatible( at io.netty.handler.ssl.SslHandler.decode( at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection( at io.netty.handler.codec.ByteToMessageDecoder.callDecode( at io.netty.handler.codec.ByteToMessageDecoder.channelRead( at at at at$HeadContext.channelRead( at at at at$ at at at at at io.netty.util.concurrent.SingleThreadEventExecutor$ at io.netty.util.internal.ThreadExecutorMap$ at at Caused by: java.lang.AssertionError: null at io.netty.handler.ssl.JdkAlpnSslEngine.verifyProtocolSelection( … 25 common frames omitted 2021-04-12 04:35:24.500 23652-23886/com.foobar D/c.g.c.n.h.p.t.TlsFrontendHandler: [nioEventLoopGroup-3-3] ALPN negotiate failed with

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

koh-osugcommented, Apr 14, 2021

I could fix this in the meanwhile. It seems to be an issue with the Android TLS implementation or the Netty not supporting it. I have patched netty to support BouncyCastle. See

koh-osugcommented, Apr 21, 2021

Fixed with #16

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android O java.lang.RuntimeException: protocol negotiation ...
I was able to reproduce and verify this cause by trying to connect to a server with only NPN, but not ALPN. The...
Read more >
Android grpc error: TLS ALPN negotiation failed with protocols
HTTP/2 is negotiated during TLS using ALPN. The client sends what protocols it supports (in this case grpc-exp and h2, aka http/2).
Read more >
TLS Application Layer Protocol Negotiation - Oracle Help Center
Set the Application Layer Protocol Negotiation (ALPN) values supported by the client. During the handshake with the server, the server will read the ......
Read more >
Authentication - android Git repositories
HTTP/2 over TLS mandates the use of ALPN to negotiate the use of the h2 protocol. ALPN is a fairly new standard and...
Read more >
Can someone give me an example with grpc-java and ssl ?
Caused by: java.lang.Exception: Failed ALPN negotiation: Unable to find compatible protocol. grpc-java wasn't able to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found