TLS 1.3 by default
TLS 1.3 is enabled by default — no explicit protocol configuration needed.
Code Comparison
✕ Java 8
SSLContext ctx =
SSLContext.getInstance("TLSv1.2");
ctx.init(null, trustManagers, null);
SSLSocketFactory factory =
ctx.getSocketFactory();
// Must specify protocol version
✓ Java 11+
// TLS 1.3 is the default!
var client = HttpClient.newBuilder()
.sslContext(SSLContext.getDefault())
.build();
// Already using TLS 1.3
Why the modern way wins
More secure
TLS 1.3 removes obsolete cipher suites and handshake patterns.
Faster handshake
TLS 1.3 completes in one round trip vs two.
Zero config
Secure by default — no explicit protocol selection needed.
Old Approach
Manual TLS Config
Modern Approach
TLS 1.3 Default
Since JDK
11
Difficulty
intermediate
JDK Support
TLS 1.3 by default
Available
Widely available since JDK 11 (Sept 2018)
How it works
Java 11 added TLS 1.3 support and made it the preferred protocol. The HttpClient uses it automatically. No more manually specifying protocol versions for secure connections.