โ— Shell
clean mode source โ†—

TLS 1.3 by default

Code Comparison

SSLContext ctx =
    SSLContext.getInstance("TLSv1.2");
ctx.init(null, trustManagers, null);
SSLSocketFactory factory =
    ctx.getSocketFactory();
// Must specify protocol version
// 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

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.

Related Documentation

Proof