java.lang.Object
org.miaixz.bus.http.accord.ConnectionSelector
Handles the fallback strategy for connection specifications: when a secure socket connection fails due to a handshake
or protocol issue, the connection may be retried with a different protocol. Instances are stateful and should be
created and used for a single connection attempt.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfigureSecureSocket(SSLSocket sslSocket) Configures theSSLSocketwith the appropriateConnectionSuitefor connecting to the specified host.booleanReports a connection failure.
-
Constructor Details
-
ConnectionSelector
Constructor- Parameters:
connectionSuites- The list of connection suites.
-
-
Method Details
-
configureSecureSocket
Configures theSSLSocketwith the appropriateConnectionSuitefor connecting to the specified host. Returns aConnectionSuiteand will not returnnull.- Parameters:
sslSocket- The SSL socket to configure.- Returns:
- The configuration for the socket connection.
- Throws:
IOException- if the socket does not support any of the available TLS modes.
-
connectionFailed
Reports a connection failure. Determines the nextConnectionSuiteto try, if any.- Parameters:
ex- The exception that occurred.- Returns:
trueif the connection should be retried withconfigureSecureSocket(SSLSocket), orfalseif no further retries are necessary.
-