GRPC Java 客户端和 NodeJS 服务器之间的 ssl 握手问题

ssl handshake issue between GRPC Java client and NodeJS server

我正在使用 GRPC(Java 客户端)通过 SSL 连接到 NodeJS 服务器。下面复制了我正在使用的 SSL 上下文。我尝试了 运行 ssldump(在 Mac El Capitan OS 上)来帮助调试。当我尝试连接并向服务器发送消息时,服务器出现以下异常:

chttp2_server.c:123] Handshaking failed: {"created":"@1489433622.628015000","description":"Handshake read failed","file":"../src/core/lib/security/transport/security_handshaker.c","file_line":238,"referenced_errors":[{"created":"@1489433622.628009000","description":"Socket closed","fd":24,"file":"../src/core/lib/iomgr/tcp_posix.c","file_line":249,"target_address":"ipv6:[::1]:60820"}]}


        SslContext sslContext = GrpcSslContexts.forClient()
                .startTls(true)
                .sslProvider(defaultSslProvider())
                .trustManager(publicCert)
                .keyManager(clientCert, clientKey)
               // .ciphers(null)  //testing
                .build();

我刚从 ssldump 中看到以下输出:

780    1880.8428 (0.0405)  C>S  TCP FIN
780    1880.8433 (0.0005)  S>C  TCP FIN
New TCP connection #1020: localhost(61531) <-> localhost(96758)
1.3625 (1.3625)  C>S
---------------------------------------------------------------
1e 0a 16 08 b9 c6 ed bc b9 9e 84 98 e3 01 10 95    ................
b8 b5 a5 8e 8c c3 bb 91 01 10 02 22 02 08 01       ..........."...
---------------------------------------------------------------

New TCP connection #1021: localhost(61532) <-> localhost(90051)

任何关于如何进一步解决此问题的想法将不胜感激。

我删除了似乎导致问题的 'usePlaintext(false)' 语句。

channelBuilder = NettyChannelBuilder.forAddress(host, port)
                    .overrideAuthority("localhost")
                    .negotiationType(NegotiationType.TLS)
                    **//.usePlaintext(false)**
                    .sslContext(sslContext);