0

我正在使用 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)

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

4

1 回答 1

0

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

channelBuilder = NettyChannelBuilder.forAddress(host, port)
                    .overrideAuthority("localhost")
                    .negotiationType(NegotiationType.TLS)
                    **//.usePlaintext(false)**
                    .sslContext(sslContext);
于 2017-03-28T16:01:15.333 回答