Hands-on AWS knowledge base for developers Managed Ops
Talk to Us

Java: Remote host closed connection during handshake

Export PDF Print-friendly layout with a copyright watermark; choose Save as PDF in the print dialog
Java: Remote host closed connection during handshake — Java: Remote host closed connection during handshake

原因

TLS 握手中途被服务端断开:JDK 版本过老不支持 TLS 1.3、服务端套件限制,或中间设备掐断握手。

解决

  1. 加 -Djavax.net.debug=ssl:handshake 看断开在哪一步;
  2. 升级 JDK 到 8u261+/11.0.7+ 支持 TLS 1.3;
  3. openssl s_client -connect 域名:443 确认服务端正常并记录其协议套件;
  4. 服务端保留 TLSv1.2 兼容旧客户端。