Package 

Class ConnectionSpec


  • 
    public final class ConnectionSpec
    
                        

    Specifies 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.

    • Method Detail

      • 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.

      • 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.