-
public final class ConnectionSpecSpecifies configuration for the socket connection that HTTP traffic travels through. For
{@code * https:}URLs, this includes the TLS version and cipher suites to use when negotiating a secure connection.The TLS versions configured in a connection spec are only be used if they are also enabled in the SSL socket. For example, if an SSL socket does not have TLS 1.3 enabled, it will not be used even if it is present on the connection spec. The same policy also applies to cipher suites.
Use allEnabledTlsVersions and allEnabledCipherSuites to defer all feature selection to the underlying SSL socket.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classConnectionSpec.Builder
-
Field Summary
Fields Modifier and Type Field Description public final static ConnectionSpecRESTRICTED_TLSpublic final static ConnectionSpecMODERN_TLSpublic final static ConnectionSpecCOMPATIBLE_TLSpublic final static ConnectionSpecCLEARTEXT
-
Method Summary
Modifier and Type Method Description booleanisTls()List<CipherSuite>cipherSuites()Returns the cipher suites to use for a connection. List<TlsVersion>tlsVersions()Returns the TLS versions to use when negotiating a connection. booleansupportsTlsExtensions()booleanisCompatible(SSLSocket socket)Returns {@code true}if the socket, as currently configured, supports this connection spec.booleanequals(@Nullable() Object other)inthashCode()StringtoString()-
-
Method Detail
-
isTls
boolean isTls()
-
cipherSuites
@Nullable() List<CipherSuite> cipherSuites()
Returns the cipher suites to use for a connection. Returns null if all of the SSL socket'senabled cipher suites should be used.
-
tlsVersions
@Nullable() List<TlsVersion> tlsVersions()
Returns the TLS versions to use when negotiating a connection. Returns null if all of the SSLsocket's enabled TLS versions should be used.
-
supportsTlsExtensions
boolean supportsTlsExtensions()
-
isCompatible
boolean isCompatible(SSLSocket socket)
Returns
{@code true}if the socket, as currently configured, supports this connection spec. Inorder for a socket to be compatible the enabled cipher suites and protocols must intersect.For cipher suites, at least one of the required cipher suites mustmatch the socket's enabled cipher suites. If there are no required cipher suites the socketmust have at least one cipher suite enabled.
For protocols, at least one of the required protocols must match thesocket's enabled protocols.
-
hashCode
int hashCode()
-
-
-
-