@@ -590,9 +590,16 @@ public AsciiString scheme() {
590590 public ChannelHandler newHandler (GrpcHttp2ConnectionHandler grpcHandler ) {
591591 ChannelHandler gnh = new GrpcNegotiationHandler (grpcHandler );
592592 ChannelLogger negotiationLogger = grpcHandler .getNegotiationLogger ();
593+ String authority ;
594+ if ("" .equals (sni )) {
595+ authority = null ;
596+ } else if (sni != null ) {
597+ authority = sni ;
598+ } else {
599+ authority = grpcHandler .getAuthority ();
600+ }
593601 ChannelHandler cth = new ClientTlsHandler (gnh , sslContext ,
594- sni != null ? sni : grpcHandler .getAuthority (),
595- this .executor , negotiationLogger , handshakeCompleteRunnable , this ,
602+ authority , this .executor , negotiationLogger , handshakeCompleteRunnable , this ,
596603 x509ExtendedTrustManager );
597604 return new WaitUntilActiveHandler (cth , negotiationLogger );
598605 }
@@ -630,7 +637,7 @@ static final class ClientTlsHandler extends ProtocolNegotiationHandler {
630637 // TODO: For empty authority and fallback flag
631638 // GRPC_USE_CHANNEL_AUTHORITY_IF_NO_SNI_APPLICABLE present, we should parse authority
632639 // but prevent it from being used for SAN validation in the TrustManager.
633- if (authority != null && ! authority . isEmpty () ) {
640+ if (authority != null ) {
634641 HostPort hostPort = parseAuthority (authority );
635642 this .host = hostPort .host ;
636643 this .port = hostPort .port ;
0 commit comments