diff --git a/netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java b/netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java index 9323c58aae1..11ac7fe197d 100644 --- a/netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java +++ b/netty/src/main/java/io/grpc/netty/ProtocolNegotiators.java @@ -698,6 +698,9 @@ protected void userEventTriggered0(ChannelHandlerContext ctx, Object evt) throws // Successfully negotiated the protocol. logSslEngineDetails(Level.FINER, ctx, "TLS negotiation succeeded.", null); propagateTlsComplete(ctx, handler.engine().getSession()); + if (handshakeCompleteRunnable.isPresent()) { + handshakeCompleteRunnable.get().run(); + } } else { Exception ex = unavailableException("Failed ALPN negotiation: Unable to find compatible protocol"); @@ -725,6 +728,9 @@ protected void userEventTriggered0(ChannelHandlerContext ctx, Object evt) throws ctx.fireExceptionCaught(t); } } else { + if (handshakeCompleteRunnable.isPresent()) { + handshakeCompleteRunnable.get().run(); + } super.userEventTriggered0(ctx, evt); } }