Class RouteSelector
java.lang.Object
com.squareup.okhttp.internal.http.RouteSelector
public final class RouteSelector extends Object
Selects routes to connect to an origin server. Each connection requires a
choice of proxy server, IP address, and TLS mode. Connections may also be
recycled.
-
Constructor Summary
Constructors Constructor Description RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool, Dns dns, RouteDatabase routeDatabase) -
Method Summary
Modifier and Type Method Description voidconnectFailed(Connection connection, IOException failure)Clients should invoke this method when they encounter a connectivity failure on a connection returned by this route selector.booleanhasNext()Returns true if there's another route to attempt.Connectionnext(String method)Returns the next route address to attempt.
-
Constructor Details
-
RouteSelector
public RouteSelector(Address address, URI uri, ProxySelector proxySelector, ConnectionPool pool, Dns dns, RouteDatabase routeDatabase)
-
-
Method Details
-
hasNext
public boolean hasNext()Returns true if there's another route to attempt. Every address has at least one route. -
next
Returns the next route address to attempt.- Throws:
NoSuchElementException- if there are no more routes to attempt.IOException
-
connectFailed
Clients should invoke this method when they encounter a connectivity failure on a connection returned by this route selector.
-