Package com.squareup.okhttp.internal
Class ConnectionSpecSelector
- java.lang.Object
-
- com.squareup.okhttp.internal.ConnectionSpecSelector
-
public final class ConnectionSpecSelector extends Object
Handles the connection spec fallback strategy: When a secure socket connection fails due to a handshake / protocol problem the connection may be retried with different protocols. Instances are stateful and should be created and used for a single connection attempt.
-
-
Constructor Summary
Constructors Constructor Description ConnectionSpecSelector(List<ConnectionSpec> connectionSpecs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectionSpecconfigureSecureSocket(SSLSocket sslSocket)Configures the suppliedSSLSocketto connect to the specified host using an appropriateConnectionSpec.booleanconnectionFailed(IOException e)Reports a failure to complete a connection.
-
-
-
Constructor Detail
-
ConnectionSpecSelector
public ConnectionSpecSelector(List<ConnectionSpec> connectionSpecs)
-
-
Method Detail
-
configureSecureSocket
public ConnectionSpec configureSecureSocket(SSLSocket sslSocket) throws IOException
Configures the suppliedSSLSocketto connect to the specified host using an appropriateConnectionSpec. Returns the chosenConnectionSpec, nevernull.- Throws:
IOException- if the socket does not support any of the TLS modes available
-
connectionFailed
public boolean connectionFailed(IOException e)
Reports a failure to complete a connection. Determines the nextConnectionSpecto try, if any.- Returns:
trueif the connection should be retried usingconfigureSecureSocket(SSLSocket)orfalseif not
-
-