RouteSelector.smali 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. .class public final Lokhttp3/internal/connection/RouteSelector;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/MemberClasses;
  6. value = {
  7. Lokhttp3/internal/connection/RouteSelector$Selection;
  8. }
  9. .end annotation
  10. # instance fields
  11. .field private final address:Lokhttp3/Address;
  12. .field private final call:Lokhttp3/Call;
  13. .field private final eventListener:Lokhttp3/EventListener;
  14. .field private inetSocketAddresses:Ljava/util/List;
  15. .annotation system Ldalvik/annotation/Signature;
  16. value = {
  17. "Ljava/util/List<",
  18. "Ljava/net/InetSocketAddress;",
  19. ">;"
  20. }
  21. .end annotation
  22. .end field
  23. .field private nextProxyIndex:I
  24. .field private final postponedRoutes:Ljava/util/List;
  25. .annotation system Ldalvik/annotation/Signature;
  26. value = {
  27. "Ljava/util/List<",
  28. "Lokhttp3/Route;",
  29. ">;"
  30. }
  31. .end annotation
  32. .end field
  33. .field private proxies:Ljava/util/List;
  34. .annotation system Ldalvik/annotation/Signature;
  35. value = {
  36. "Ljava/util/List<",
  37. "Ljava/net/Proxy;",
  38. ">;"
  39. }
  40. .end annotation
  41. .end field
  42. .field private final routeDatabase:Lokhttp3/internal/connection/RouteDatabase;
  43. # direct methods
  44. .method public constructor <init>(Lokhttp3/Address;Lokhttp3/internal/connection/RouteDatabase;Lokhttp3/Call;Lokhttp3/EventListener;)V
  45. .locals 1
  46. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  47. invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
  48. move-result-object v0
  49. iput-object v0, p0, Lokhttp3/internal/connection/RouteSelector;->proxies:Ljava/util/List;
  50. invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
  51. move-result-object v0
  52. iput-object v0, p0, Lokhttp3/internal/connection/RouteSelector;->inetSocketAddresses:Ljava/util/List;
  53. new-instance v0, Ljava/util/ArrayList;
  54. invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
  55. iput-object v0, p0, Lokhttp3/internal/connection/RouteSelector;->postponedRoutes:Ljava/util/List;
  56. iput-object p1, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  57. iput-object p2, p0, Lokhttp3/internal/connection/RouteSelector;->routeDatabase:Lokhttp3/internal/connection/RouteDatabase;
  58. iput-object p3, p0, Lokhttp3/internal/connection/RouteSelector;->call:Lokhttp3/Call;
  59. iput-object p4, p0, Lokhttp3/internal/connection/RouteSelector;->eventListener:Lokhttp3/EventListener;
  60. invoke-virtual {p1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  61. move-result-object p2
  62. invoke-virtual {p1}, Lokhttp3/Address;->proxy()Ljava/net/Proxy;
  63. move-result-object p1
  64. invoke-direct {p0, p2, p1}, Lokhttp3/internal/connection/RouteSelector;->resetNextProxy(Lokhttp3/HttpUrl;Ljava/net/Proxy;)V
  65. return-void
  66. .end method
  67. .method static getHostString(Ljava/net/InetSocketAddress;)Ljava/lang/String;
  68. .locals 1
  69. invoke-virtual {p0}, Ljava/net/InetSocketAddress;->getAddress()Ljava/net/InetAddress;
  70. move-result-object v0
  71. if-nez v0, :cond_0
  72. invoke-virtual {p0}, Ljava/net/InetSocketAddress;->getHostName()Ljava/lang/String;
  73. move-result-object p0
  74. return-object p0
  75. :cond_0
  76. invoke-virtual {v0}, Ljava/net/InetAddress;->getHostAddress()Ljava/lang/String;
  77. move-result-object p0
  78. return-object p0
  79. .end method
  80. .method private hasNextProxy()Z
  81. .locals 2
  82. iget v0, p0, Lokhttp3/internal/connection/RouteSelector;->nextProxyIndex:I
  83. iget-object v1, p0, Lokhttp3/internal/connection/RouteSelector;->proxies:Ljava/util/List;
  84. invoke-interface {v1}, Ljava/util/List;->size()I
  85. move-result v1
  86. if-ge v0, v1, :cond_0
  87. const/4 v0, 0x1
  88. goto :goto_0
  89. :cond_0
  90. const/4 v0, 0x0
  91. :goto_0
  92. return v0
  93. .end method
  94. .method private nextProxy()Ljava/net/Proxy;
  95. .locals 3
  96. .annotation system Ldalvik/annotation/Throws;
  97. value = {
  98. Ljava/io/IOException;
  99. }
  100. .end annotation
  101. invoke-direct {p0}, Lokhttp3/internal/connection/RouteSelector;->hasNextProxy()Z
  102. move-result v0
  103. if-eqz v0, :cond_0
  104. iget-object v0, p0, Lokhttp3/internal/connection/RouteSelector;->proxies:Ljava/util/List;
  105. iget v1, p0, Lokhttp3/internal/connection/RouteSelector;->nextProxyIndex:I
  106. add-int/lit8 v2, v1, 0x1
  107. iput v2, p0, Lokhttp3/internal/connection/RouteSelector;->nextProxyIndex:I
  108. invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
  109. move-result-object v0
  110. check-cast v0, Ljava/net/Proxy;
  111. invoke-direct {p0, v0}, Lokhttp3/internal/connection/RouteSelector;->resetNextInetSocketAddress(Ljava/net/Proxy;)V
  112. return-object v0
  113. :cond_0
  114. new-instance v0, Ljava/net/SocketException;
  115. new-instance v1, Ljava/lang/StringBuilder;
  116. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  117. const-string v2, "No route to "
  118. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  119. iget-object v2, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  120. invoke-virtual {v2}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  121. move-result-object v2
  122. invoke-virtual {v2}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  123. move-result-object v2
  124. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  125. const-string v2, "; exhausted proxy configurations: "
  126. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  127. iget-object v2, p0, Lokhttp3/internal/connection/RouteSelector;->proxies:Ljava/util/List;
  128. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  129. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  130. move-result-object v1
  131. invoke-direct {v0, v1}, Ljava/net/SocketException;-><init>(Ljava/lang/String;)V
  132. throw v0
  133. .end method
  134. .method private resetNextInetSocketAddress(Ljava/net/Proxy;)V
  135. .locals 6
  136. .annotation system Ldalvik/annotation/Throws;
  137. value = {
  138. Ljava/io/IOException;
  139. }
  140. .end annotation
  141. new-instance v0, Ljava/util/ArrayList;
  142. invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
  143. iput-object v0, p0, Lokhttp3/internal/connection/RouteSelector;->inetSocketAddresses:Ljava/util/List;
  144. invoke-virtual {p1}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
  145. move-result-object v0
  146. sget-object v1, Ljava/net/Proxy$Type;->DIRECT:Ljava/net/Proxy$Type;
  147. if-eq v0, v1, :cond_2
  148. invoke-virtual {p1}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
  149. move-result-object v0
  150. sget-object v1, Ljava/net/Proxy$Type;->SOCKS:Ljava/net/Proxy$Type;
  151. if-ne v0, v1, :cond_0
  152. goto :goto_0
  153. :cond_0
  154. invoke-virtual {p1}, Ljava/net/Proxy;->address()Ljava/net/SocketAddress;
  155. move-result-object v0
  156. instance-of v1, v0, Ljava/net/InetSocketAddress;
  157. if-eqz v1, :cond_1
  158. check-cast v0, Ljava/net/InetSocketAddress;
  159. invoke-static {v0}, Lokhttp3/internal/connection/RouteSelector;->getHostString(Ljava/net/InetSocketAddress;)Ljava/lang/String;
  160. move-result-object v1
  161. invoke-virtual {v0}, Ljava/net/InetSocketAddress;->getPort()I
  162. move-result v0
  163. goto :goto_1
  164. :cond_1
  165. new-instance p1, Ljava/lang/IllegalArgumentException;
  166. new-instance v1, Ljava/lang/StringBuilder;
  167. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  168. const-string v2, "Proxy.address() is not an InetSocketAddress: "
  169. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  170. invoke-virtual {v0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
  171. move-result-object v0
  172. invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  173. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  174. move-result-object v0
  175. invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  176. throw p1
  177. :cond_2
  178. :goto_0
  179. iget-object v0, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  180. invoke-virtual {v0}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  181. move-result-object v0
  182. invoke-virtual {v0}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  183. move-result-object v1
  184. iget-object v0, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  185. invoke-virtual {v0}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  186. move-result-object v0
  187. invoke-virtual {v0}, Lokhttp3/HttpUrl;->port()I
  188. move-result v0
  189. :goto_1
  190. const/4 v2, 0x1
  191. if-lt v0, v2, :cond_6
  192. const v2, 0xffff
  193. if-gt v0, v2, :cond_6
  194. invoke-virtual {p1}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
  195. move-result-object p1
  196. sget-object v2, Ljava/net/Proxy$Type;->SOCKS:Ljava/net/Proxy$Type;
  197. if-ne p1, v2, :cond_3
  198. iget-object p1, p0, Lokhttp3/internal/connection/RouteSelector;->inetSocketAddresses:Ljava/util/List;
  199. invoke-static {v1, v0}, Ljava/net/InetSocketAddress;->createUnresolved(Ljava/lang/String;I)Ljava/net/InetSocketAddress;
  200. move-result-object v0
  201. invoke-interface {p1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  202. goto :goto_3
  203. :cond_3
  204. iget-object p1, p0, Lokhttp3/internal/connection/RouteSelector;->eventListener:Lokhttp3/EventListener;
  205. iget-object v2, p0, Lokhttp3/internal/connection/RouteSelector;->call:Lokhttp3/Call;
  206. invoke-virtual {p1, v2, v1}, Lokhttp3/EventListener;->dnsStart(Lokhttp3/Call;Ljava/lang/String;)V
  207. iget-object p1, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  208. invoke-virtual {p1}, Lokhttp3/Address;->dns()Lokhttp3/Dns;
  209. move-result-object p1
  210. invoke-interface {p1, v1}, Lokhttp3/Dns;->lookup(Ljava/lang/String;)Ljava/util/List;
  211. move-result-object p1
  212. invoke-interface {p1}, Ljava/util/List;->isEmpty()Z
  213. move-result v2
  214. if-nez v2, :cond_5
  215. iget-object v2, p0, Lokhttp3/internal/connection/RouteSelector;->eventListener:Lokhttp3/EventListener;
  216. iget-object v3, p0, Lokhttp3/internal/connection/RouteSelector;->call:Lokhttp3/Call;
  217. invoke-virtual {v2, v3, v1, p1}, Lokhttp3/EventListener;->dnsEnd(Lokhttp3/Call;Ljava/lang/String;Ljava/util/List;)V
  218. const/4 v1, 0x0
  219. invoke-interface {p1}, Ljava/util/List;->size()I
  220. move-result v2
  221. :goto_2
  222. if-ge v1, v2, :cond_4
  223. invoke-interface {p1, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
  224. move-result-object v3
  225. check-cast v3, Ljava/net/InetAddress;
  226. iget-object v4, p0, Lokhttp3/internal/connection/RouteSelector;->inetSocketAddresses:Ljava/util/List;
  227. new-instance v5, Ljava/net/InetSocketAddress;
  228. invoke-direct {v5, v3, v0}, Ljava/net/InetSocketAddress;-><init>(Ljava/net/InetAddress;I)V
  229. invoke-interface {v4, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  230. add-int/lit8 v1, v1, 0x1
  231. goto :goto_2
  232. :cond_4
  233. :goto_3
  234. return-void
  235. :cond_5
  236. new-instance p1, Ljava/net/UnknownHostException;
  237. new-instance v0, Ljava/lang/StringBuilder;
  238. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  239. iget-object v2, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  240. invoke-virtual {v2}, Lokhttp3/Address;->dns()Lokhttp3/Dns;
  241. move-result-object v2
  242. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  243. const-string v2, " returned no addresses for "
  244. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  245. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  246. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  247. move-result-object v0
  248. invoke-direct {p1, v0}, Ljava/net/UnknownHostException;-><init>(Ljava/lang/String;)V
  249. throw p1
  250. :cond_6
  251. new-instance p1, Ljava/net/SocketException;
  252. new-instance v2, Ljava/lang/StringBuilder;
  253. invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
  254. const-string v3, "No route to "
  255. invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  256. invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  257. const-string v1, ":"
  258. invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  259. invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  260. const-string v0, "; port is out of range"
  261. invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  262. invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  263. move-result-object v0
  264. invoke-direct {p1, v0}, Ljava/net/SocketException;-><init>(Ljava/lang/String;)V
  265. goto :goto_5
  266. :goto_4
  267. throw p1
  268. :goto_5
  269. goto :goto_4
  270. .end method
  271. .method private resetNextProxy(Lokhttp3/HttpUrl;Ljava/net/Proxy;)V
  272. .locals 1
  273. const/4 v0, 0x0
  274. if-eqz p2, :cond_0
  275. invoke-static {p2}, Ljava/util/Collections;->singletonList(Ljava/lang/Object;)Ljava/util/List;
  276. move-result-object p1
  277. :goto_0
  278. iput-object p1, p0, Lokhttp3/internal/connection/RouteSelector;->proxies:Ljava/util/List;
  279. goto :goto_1
  280. :cond_0
  281. iget-object p2, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  282. invoke-virtual {p2}, Lokhttp3/Address;->proxySelector()Ljava/net/ProxySelector;
  283. move-result-object p2
  284. invoke-virtual {p1}, Lokhttp3/HttpUrl;->uri()Ljava/net/URI;
  285. move-result-object p1
  286. invoke-virtual {p2, p1}, Ljava/net/ProxySelector;->select(Ljava/net/URI;)Ljava/util/List;
  287. move-result-object p1
  288. if-eqz p1, :cond_1
  289. invoke-interface {p1}, Ljava/util/List;->isEmpty()Z
  290. move-result p2
  291. if-nez p2, :cond_1
  292. invoke-static {p1}, Lokhttp3/internal/Util;->immutableList(Ljava/util/List;)Ljava/util/List;
  293. move-result-object p1
  294. goto :goto_0
  295. :cond_1
  296. const/4 p1, 0x1
  297. new-array p1, p1, [Ljava/net/Proxy;
  298. sget-object p2, Ljava/net/Proxy;->NO_PROXY:Ljava/net/Proxy;
  299. aput-object p2, p1, v0
  300. invoke-static {p1}, Lokhttp3/internal/Util;->immutableList([Ljava/lang/Object;)Ljava/util/List;
  301. move-result-object p1
  302. goto :goto_0
  303. :goto_1
  304. iput v0, p0, Lokhttp3/internal/connection/RouteSelector;->nextProxyIndex:I
  305. return-void
  306. .end method
  307. # virtual methods
  308. .method public connectFailed(Lokhttp3/Route;Ljava/io/IOException;)V
  309. .locals 3
  310. invoke-virtual {p1}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
  311. move-result-object v0
  312. invoke-virtual {v0}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
  313. move-result-object v0
  314. sget-object v1, Ljava/net/Proxy$Type;->DIRECT:Ljava/net/Proxy$Type;
  315. if-eq v0, v1, :cond_0
  316. iget-object v0, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  317. invoke-virtual {v0}, Lokhttp3/Address;->proxySelector()Ljava/net/ProxySelector;
  318. move-result-object v0
  319. if-eqz v0, :cond_0
  320. iget-object v0, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  321. invoke-virtual {v0}, Lokhttp3/Address;->proxySelector()Ljava/net/ProxySelector;
  322. move-result-object v0
  323. iget-object v1, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  324. invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  325. move-result-object v1
  326. invoke-virtual {v1}, Lokhttp3/HttpUrl;->uri()Ljava/net/URI;
  327. move-result-object v1
  328. invoke-virtual {p1}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
  329. move-result-object v2
  330. invoke-virtual {v2}, Ljava/net/Proxy;->address()Ljava/net/SocketAddress;
  331. move-result-object v2
  332. invoke-virtual {v0, v1, v2, p2}, Ljava/net/ProxySelector;->connectFailed(Ljava/net/URI;Ljava/net/SocketAddress;Ljava/io/IOException;)V
  333. :cond_0
  334. iget-object p2, p0, Lokhttp3/internal/connection/RouteSelector;->routeDatabase:Lokhttp3/internal/connection/RouteDatabase;
  335. invoke-virtual {p2, p1}, Lokhttp3/internal/connection/RouteDatabase;->failed(Lokhttp3/Route;)V
  336. return-void
  337. .end method
  338. .method public hasNext()Z
  339. .locals 1
  340. invoke-direct {p0}, Lokhttp3/internal/connection/RouteSelector;->hasNextProxy()Z
  341. move-result v0
  342. if-nez v0, :cond_1
  343. iget-object v0, p0, Lokhttp3/internal/connection/RouteSelector;->postponedRoutes:Ljava/util/List;
  344. invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
  345. move-result v0
  346. if-nez v0, :cond_0
  347. goto :goto_0
  348. :cond_0
  349. const/4 v0, 0x0
  350. goto :goto_1
  351. :cond_1
  352. :goto_0
  353. const/4 v0, 0x1
  354. :goto_1
  355. return v0
  356. .end method
  357. .method public next()Lokhttp3/internal/connection/RouteSelector$Selection;
  358. .locals 7
  359. .annotation system Ldalvik/annotation/Throws;
  360. value = {
  361. Ljava/io/IOException;
  362. }
  363. .end annotation
  364. invoke-virtual {p0}, Lokhttp3/internal/connection/RouteSelector;->hasNext()Z
  365. move-result v0
  366. if-eqz v0, :cond_5
  367. new-instance v0, Ljava/util/ArrayList;
  368. invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
  369. :cond_0
  370. invoke-direct {p0}, Lokhttp3/internal/connection/RouteSelector;->hasNextProxy()Z
  371. move-result v1
  372. if-eqz v1, :cond_3
  373. invoke-direct {p0}, Lokhttp3/internal/connection/RouteSelector;->nextProxy()Ljava/net/Proxy;
  374. move-result-object v1
  375. const/4 v2, 0x0
  376. iget-object v3, p0, Lokhttp3/internal/connection/RouteSelector;->inetSocketAddresses:Ljava/util/List;
  377. invoke-interface {v3}, Ljava/util/List;->size()I
  378. move-result v3
  379. :goto_0
  380. if-ge v2, v3, :cond_2
  381. new-instance v4, Lokhttp3/Route;
  382. iget-object v5, p0, Lokhttp3/internal/connection/RouteSelector;->address:Lokhttp3/Address;
  383. iget-object v6, p0, Lokhttp3/internal/connection/RouteSelector;->inetSocketAddresses:Ljava/util/List;
  384. invoke-interface {v6, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
  385. move-result-object v6
  386. check-cast v6, Ljava/net/InetSocketAddress;
  387. invoke-direct {v4, v5, v1, v6}, Lokhttp3/Route;-><init>(Lokhttp3/Address;Ljava/net/Proxy;Ljava/net/InetSocketAddress;)V
  388. iget-object v5, p0, Lokhttp3/internal/connection/RouteSelector;->routeDatabase:Lokhttp3/internal/connection/RouteDatabase;
  389. invoke-virtual {v5, v4}, Lokhttp3/internal/connection/RouteDatabase;->shouldPostpone(Lokhttp3/Route;)Z
  390. move-result v5
  391. if-eqz v5, :cond_1
  392. iget-object v5, p0, Lokhttp3/internal/connection/RouteSelector;->postponedRoutes:Ljava/util/List;
  393. invoke-interface {v5, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  394. goto :goto_1
  395. :cond_1
  396. invoke-interface {v0, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  397. :goto_1
  398. add-int/lit8 v2, v2, 0x1
  399. goto :goto_0
  400. :cond_2
  401. invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
  402. move-result v1
  403. if-nez v1, :cond_0
  404. :cond_3
  405. invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
  406. move-result v1
  407. if-eqz v1, :cond_4
  408. iget-object v1, p0, Lokhttp3/internal/connection/RouteSelector;->postponedRoutes:Ljava/util/List;
  409. invoke-interface {v0, v1}, Ljava/util/List;->addAll(Ljava/util/Collection;)Z
  410. iget-object v1, p0, Lokhttp3/internal/connection/RouteSelector;->postponedRoutes:Ljava/util/List;
  411. invoke-interface {v1}, Ljava/util/List;->clear()V
  412. :cond_4
  413. new-instance v1, Lokhttp3/internal/connection/RouteSelector$Selection;
  414. invoke-direct {v1, v0}, Lokhttp3/internal/connection/RouteSelector$Selection;-><init>(Ljava/util/List;)V
  415. return-object v1
  416. :cond_5
  417. new-instance v0, Ljava/util/NoSuchElementException;
  418. invoke-direct {v0}, Ljava/util/NoSuchElementException;-><init>()V
  419. goto :goto_3
  420. :goto_2
  421. throw v0
  422. :goto_3
  423. goto :goto_2
  424. .end method