我正在将我们的代码库从Oracle Java 1.8.0_131迁移到OpenJDK 11.0.1.我们有实现nio-ssl套接字通道的代码.在Java 8中,客户端/服务器握手工作正常.在Java 11中,客户端在从服务器解包最后一次握手消息之前完成握手.
为了解决这个问题,我只是在客户端和服务器之间建立连接,让它们执行SSL握手.我没有发送任何额外的数据.
我使用java 8建立连接并获取下面的输出.然后我使用java 11编译,构建和运行相同的代码,并获得下面的其他输出.我不会改变任何代码.
我在客户端和服务器上都有一些日志记录,以显示握手中的哪一步.
日志输出Java 8 - 客户端
SSL Handshake Started
WRAP:OK - BytesProduced=172 BytesConsumed=0
UNWRAP:OK - BytesProduced=0 BytesConsumed=2295
TASK
WRAP:OK - BytesProduced=1815 BytesConsumed=0
WRAP:OK - BytesProduced=269 BytesConsumed=0
WRAP:OK - BytesProduced=6 BytesConsumed=0
WRAP:OK - BytesProduced=85 BytesConsumed=0
UNWRAP:OK - BytesProduced=0 BytesConsumed=6
UNWRAP:OK - BytesProduced=0 BytesConsumed=85
SSL Handshake complete
Run Code Online (Sandbox Code Playgroud)
日志输出Java 8 - 服务器
SSL Handshake Started
UNWRAP:OK - BytesProduced=0 BytesConsumed=172
TASK
WRAP:OK - BytesProduced=2295 BytesConsumed=0
UNWRAP:OK - BytesProduced=0 BytesConsumed=1815
TASK
UNWRAP:OK - BytesProduced=0 BytesConsumed=269
TASK …Run Code Online (Sandbox Code Playgroud)