37 lines
744 B
Plaintext
37 lines
744 B
Plaintext
|
|
== How to fix it in OkHttp
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,java,diff-id=11,diff-type=noncompliant]
|
|
----
|
|
import okhttp3.ConnectionSpec;
|
|
import okhttp3.TlsVersion;
|
|
|
|
public static void main(String[] args) {
|
|
new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
|
|
.tlsVersions(TlsVersion.TLS_1_1) // Noncompliant
|
|
.build();
|
|
}
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,java,diff-id=11,diff-type=compliant]
|
|
----
|
|
import okhttp3.ConnectionSpec;
|
|
import okhttp3.TlsVersion;
|
|
|
|
public static void main(String[] args) {
|
|
new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
|
|
.tlsVersions(TlsVersion.TLS_1_2)
|
|
.build();
|
|
}
|
|
----
|
|
|
|
=== How does this work?
|
|
|
|
include::../../common/fix/fix.adoc[]
|