2017-03-13 105 views
0

我正在使用GRPC(Java客戶端)通過SSL連接到NodeJS服務器。我正在使用的SSL上下文複製如下。我試着運行ssldump(在Mac El Capitan OS上)來幫助調試。我得到的服務器上的以下異常,當我嘗試連接併發送消息到服務器:GRPC Java客戶端和NodeJS服務器之間的ssl握手問題

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) 

如何有什麼想法排除此任何進一步將不勝感激。

回答

0

我刪除了'usePlaintext(false)'語句,它似乎導致了這個問題。

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