java.lang.Object
org.miaixz.bus.http.accord.ConnectionSuite
Specifies the configuration for a socket connection over which HTTP is transported. For
https: URLs, this
includes the TLS versions and cipher suites to use when negotiating a secure connection.
Only TLS versions configured in the connection specification that are also enabled in the SSL socket will be used. For example, if TLS 1.3 is not enabled in the SSL socket, it will not be used even if it appears in the connection specification. The same policy applies to cipher suites.
Use ConnectionSuite.Builder.allEnabledTlsVersions() and ConnectionSuite.Builder.allEnabledCipherSuites() to defer all feature
selection to the underlying SSL socket.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder for creatingConnectionSuiteinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConnectionSuiteAn unencrypted, unauthenticated connection forhttp:URLs.static final ConnectionSuiteA TLS connection with extensions like SNI and ALPN available. -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies this specification to thesslSocket.Returns the cipher suites to use for the connection.booleaninthashCode()booleanisCompatible(SSLSocket socket) Returnstrueif the currently configured socket supports this connection specification.booleanisTls()Returns true if this connection suite is for TLS connections.booleanReturns true if TLS extensions like Server Name Indication (SNI) and Application-Layer Protocol Negotiation (ALPN) should be used.List<org.miaixz.bus.core.net.tls.TlsVersion> Returns the TLS versions to use when negotiating a connection.toString()
-
Field Details
-
CLEARTEXT
An unencrypted, unauthenticated connection forhttp:URLs. -
MODERN_TLS
A TLS connection with extensions like SNI and ALPN available.
-
-
Method Details
-
isTls
public boolean isTls()Returns true if this connection suite is for TLS connections.- Returns:
trueif this is a TLS connection suite.
-
cipherSuites
Returns the cipher suites to use for the connection. If all enabled cipher suites of the SSL socket should be used, this returns null.- Returns:
- A list of cipher suites, or null.
-
tlsVersions
Returns the TLS versions to use when negotiating a connection. If all enabled TLS versions of the SSL socket should be used, this returns null.- Returns:
- A list of TLS versions, or null.
-
supportsTlsExtensions
public boolean supportsTlsExtensions()Returns true if TLS extensions like Server Name Indication (SNI) and Application-Layer Protocol Negotiation (ALPN) should be used.- Returns:
trueif TLS extensions are supported.
-
apply
Applies this specification to thesslSocket.- Parameters:
sslSocket- The SSL socket to configure.isFallback- Whether this is a fallback connection.
-
isCompatible
Returnstrueif the currently configured socket supports this connection specification. For a socket to be compatible, the enabled cipher suites and protocols must intersect. For cipher suites, at least one of therequired cipher suitesmust match an enabled cipher suite on the socket. If no cipher suites are required, the socket must have at least one enabled cipher suite. For protocols, at least one of therequired protocolsmust match an enabled protocol on the socket.- Parameters:
socket- The SSL socket to check.- Returns:
trueif the socket is compatible.
-
equals
-
hashCode
public int hashCode() -
toString
-