TLS 1.3 by default
TLS 1.3 is enabled by default — no explicit protocol configuration needed.
Porównanie kodu
✕ 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
Widzisz problem z tym kodem? Daj nam znać.
Dlaczego nowoczesne podejście wygrywa
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.
Stare podejście
Manual TLS Config
Nowoczesne podejście
TLS 1.3 Default
Od JDK
11
Poziom trudności
Średniozaawansowany
Wsparcie JDK
TLS 1.3 by default
Dostępne
Widely available since JDK 11 (Sept 2018)
Jak to działa
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.
Powiązana dokumentacja