RealConnection.smali 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142
  1. .class public final Lokhttp3/internal/connection/RealConnection;
  2. .super Lokhttp3/internal/http2/Http2Connection$Listener;
  3. .source ""
  4. # interfaces
  5. .implements Lokhttp3/Connection;
  6. # static fields
  7. .field private static final MAX_TUNNEL_ATTEMPTS:I = 0x15
  8. .field private static final NPE_THROW_WITH_NULL:Ljava/lang/String; = "throw with null exception"
  9. # instance fields
  10. .field public allocationLimit:I
  11. .field public final allocations:Ljava/util/List;
  12. .annotation system Ldalvik/annotation/Signature;
  13. value = {
  14. "Ljava/util/List<",
  15. "Ljava/lang/ref/Reference<",
  16. "Lokhttp3/internal/connection/StreamAllocation;",
  17. ">;>;"
  18. }
  19. .end annotation
  20. .end field
  21. .field private final connectionPool:Lokhttp3/ConnectionPool;
  22. .field private handshake:Lokhttp3/Handshake;
  23. .field private http2Connection:Lokhttp3/internal/http2/Http2Connection;
  24. .field public idleAtNanos:J
  25. .field public noNewStreams:Z
  26. .field private protocol:Lokhttp3/Protocol;
  27. .field private rawSocket:Ljava/net/Socket;
  28. .field private final route:Lokhttp3/Route;
  29. .field private sink:Lokio/BufferedSink;
  30. .field private socket:Ljava/net/Socket;
  31. .field private source:Lokio/BufferedSource;
  32. .field public successCount:I
  33. # direct methods
  34. .method public constructor <init>(Lokhttp3/ConnectionPool;Lokhttp3/Route;)V
  35. .locals 2
  36. invoke-direct {p0}, Lokhttp3/internal/http2/Http2Connection$Listener;-><init>()V
  37. const/4 v0, 0x1
  38. iput v0, p0, Lokhttp3/internal/connection/RealConnection;->allocationLimit:I
  39. new-instance v0, Ljava/util/ArrayList;
  40. invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
  41. iput-object v0, p0, Lokhttp3/internal/connection/RealConnection;->allocations:Ljava/util/List;
  42. const-wide v0, 0x7fffffffffffffffL
  43. iput-wide v0, p0, Lokhttp3/internal/connection/RealConnection;->idleAtNanos:J
  44. iput-object p1, p0, Lokhttp3/internal/connection/RealConnection;->connectionPool:Lokhttp3/ConnectionPool;
  45. iput-object p2, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  46. return-void
  47. .end method
  48. .method private connectSocket(IILokhttp3/Call;Lokhttp3/EventListener;)V
  49. .locals 4
  50. .annotation system Ldalvik/annotation/Throws;
  51. value = {
  52. Ljava/io/IOException;
  53. }
  54. .end annotation
  55. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  56. invoke-virtual {v0}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
  57. move-result-object v0
  58. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  59. invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
  60. move-result-object v1
  61. invoke-virtual {v0}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
  62. move-result-object v2
  63. sget-object v3, Ljava/net/Proxy$Type;->DIRECT:Ljava/net/Proxy$Type;
  64. if-eq v2, v3, :cond_1
  65. invoke-virtual {v0}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
  66. move-result-object v2
  67. sget-object v3, Ljava/net/Proxy$Type;->HTTP:Ljava/net/Proxy$Type;
  68. if-ne v2, v3, :cond_0
  69. goto :goto_0
  70. :cond_0
  71. new-instance v1, Ljava/net/Socket;
  72. invoke-direct {v1, v0}, Ljava/net/Socket;-><init>(Ljava/net/Proxy;)V
  73. goto :goto_1
  74. :cond_1
  75. :goto_0
  76. invoke-virtual {v1}, Lokhttp3/Address;->socketFactory()Ljavax/net/SocketFactory;
  77. move-result-object v1
  78. invoke-virtual {v1}, Ljavax/net/SocketFactory;->createSocket()Ljava/net/Socket;
  79. move-result-object v1
  80. :goto_1
  81. iput-object v1, p0, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  82. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  83. invoke-virtual {v1}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
  84. move-result-object v1
  85. invoke-virtual {p4, p3, v1, v0}, Lokhttp3/EventListener;->connectStart(Lokhttp3/Call;Ljava/net/InetSocketAddress;Ljava/net/Proxy;)V
  86. iget-object p3, p0, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  87. invoke-virtual {p3, p2}, Ljava/net/Socket;->setSoTimeout(I)V
  88. :try_start_0
  89. invoke-static {}, Lokhttp3/internal/platform/Platform;->get()Lokhttp3/internal/platform/Platform;
  90. move-result-object p2
  91. iget-object p3, p0, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  92. iget-object p4, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  93. invoke-virtual {p4}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
  94. move-result-object p4
  95. invoke-virtual {p2, p3, p4, p1}, Lokhttp3/internal/platform/Platform;->connectSocket(Ljava/net/Socket;Ljava/net/InetSocketAddress;I)V
  96. :try_end_0
  97. .catch Ljava/net/ConnectException; {:try_start_0 .. :try_end_0} :catch_1
  98. :try_start_1
  99. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  100. invoke-static {p1}, Lokio/Okio;->source(Ljava/net/Socket;)Lokio/Source;
  101. move-result-object p1
  102. invoke-static {p1}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
  103. move-result-object p1
  104. iput-object p1, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  105. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  106. invoke-static {p1}, Lokio/Okio;->sink(Ljava/net/Socket;)Lokio/Sink;
  107. move-result-object p1
  108. invoke-static {p1}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink;
  109. move-result-object p1
  110. iput-object p1, p0, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  111. :try_end_1
  112. .catch Ljava/lang/NullPointerException; {:try_start_1 .. :try_end_1} :catch_0
  113. goto :goto_2
  114. :catch_0
  115. move-exception p1
  116. invoke-virtual {p1}, Ljava/lang/NullPointerException;->getMessage()Ljava/lang/String;
  117. move-result-object p2
  118. const-string p3, "throw with null exception"
  119. invoke-virtual {p3, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
  120. move-result p2
  121. if-nez p2, :cond_2
  122. :goto_2
  123. return-void
  124. :cond_2
  125. new-instance p2, Ljava/io/IOException;
  126. invoke-direct {p2, p1}, Ljava/io/IOException;-><init>(Ljava/lang/Throwable;)V
  127. throw p2
  128. :catch_1
  129. move-exception p1
  130. new-instance p2, Ljava/net/ConnectException;
  131. new-instance p3, Ljava/lang/StringBuilder;
  132. invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V
  133. const-string p4, "Failed to connect to "
  134. invoke-virtual {p3, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  135. iget-object p4, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  136. invoke-virtual {p4}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
  137. move-result-object p4
  138. invoke-virtual {p3, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  139. invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  140. move-result-object p3
  141. invoke-direct {p2, p3}, Ljava/net/ConnectException;-><init>(Ljava/lang/String;)V
  142. invoke-virtual {p2, p1}, Ljava/net/ConnectException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;
  143. throw p2
  144. .end method
  145. .method private connectTls(Lokhttp3/internal/connection/ConnectionSpecSelector;)V
  146. .locals 7
  147. .annotation system Ldalvik/annotation/Throws;
  148. value = {
  149. Ljava/io/IOException;
  150. }
  151. .end annotation
  152. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  153. invoke-virtual {v0}, Lokhttp3/Route;->address()Lokhttp3/Address;
  154. move-result-object v0
  155. invoke-virtual {v0}, Lokhttp3/Address;->sslSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
  156. move-result-object v1
  157. const/4 v2, 0x0
  158. :try_start_0
  159. iget-object v3, p0, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  160. invoke-virtual {v0}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  161. move-result-object v4
  162. invoke-virtual {v4}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  163. move-result-object v4
  164. invoke-virtual {v0}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  165. move-result-object v5
  166. invoke-virtual {v5}, Lokhttp3/HttpUrl;->port()I
  167. move-result v5
  168. const/4 v6, 0x1
  169. invoke-virtual {v1, v3, v4, v5, v6}, Ljavax/net/ssl/SSLSocketFactory;->createSocket(Ljava/net/Socket;Ljava/lang/String;IZ)Ljava/net/Socket;
  170. move-result-object v1
  171. check-cast v1, Ljavax/net/ssl/SSLSocket;
  172. :try_end_0
  173. .catch Ljava/lang/AssertionError; {:try_start_0 .. :try_end_0} :catch_1
  174. .catchall {:try_start_0 .. :try_end_0} :catchall_1
  175. :try_start_1
  176. invoke-virtual {p1, v1}, Lokhttp3/internal/connection/ConnectionSpecSelector;->configureSecureSocket(Ljavax/net/ssl/SSLSocket;)Lokhttp3/ConnectionSpec;
  177. move-result-object p1
  178. invoke-virtual {p1}, Lokhttp3/ConnectionSpec;->supportsTlsExtensions()Z
  179. move-result v3
  180. if-eqz v3, :cond_0
  181. invoke-static {}, Lokhttp3/internal/platform/Platform;->get()Lokhttp3/internal/platform/Platform;
  182. move-result-object v3
  183. invoke-virtual {v0}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  184. move-result-object v4
  185. invoke-virtual {v4}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  186. move-result-object v4
  187. invoke-virtual {v0}, Lokhttp3/Address;->protocols()Ljava/util/List;
  188. move-result-object v5
  189. invoke-virtual {v3, v1, v4, v5}, Lokhttp3/internal/platform/Platform;->configureTlsExtensions(Ljavax/net/ssl/SSLSocket;Ljava/lang/String;Ljava/util/List;)V
  190. :cond_0
  191. invoke-virtual {v1}, Ljavax/net/ssl/SSLSocket;->startHandshake()V
  192. invoke-virtual {v1}, Ljavax/net/ssl/SSLSocket;->getSession()Ljavax/net/ssl/SSLSession;
  193. move-result-object v3
  194. invoke-static {v3}, Lokhttp3/Handshake;->get(Ljavax/net/ssl/SSLSession;)Lokhttp3/Handshake;
  195. move-result-object v3
  196. invoke-virtual {v0}, Lokhttp3/Address;->hostnameVerifier()Ljavax/net/ssl/HostnameVerifier;
  197. move-result-object v4
  198. invoke-virtual {v0}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  199. move-result-object v5
  200. invoke-virtual {v5}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  201. move-result-object v5
  202. invoke-virtual {v1}, Ljavax/net/ssl/SSLSocket;->getSession()Ljavax/net/ssl/SSLSession;
  203. move-result-object v6
  204. invoke-interface {v4, v5, v6}, Ljavax/net/ssl/HostnameVerifier;->verify(Ljava/lang/String;Ljavax/net/ssl/SSLSession;)Z
  205. move-result v4
  206. if-eqz v4, :cond_4
  207. invoke-virtual {v0}, Lokhttp3/Address;->certificatePinner()Lokhttp3/CertificatePinner;
  208. move-result-object v4
  209. invoke-virtual {v0}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  210. move-result-object v0
  211. invoke-virtual {v0}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  212. move-result-object v0
  213. invoke-virtual {v3}, Lokhttp3/Handshake;->peerCertificates()Ljava/util/List;
  214. move-result-object v5
  215. invoke-virtual {v4, v0, v5}, Lokhttp3/CertificatePinner;->check(Ljava/lang/String;Ljava/util/List;)V
  216. invoke-virtual {p1}, Lokhttp3/ConnectionSpec;->supportsTlsExtensions()Z
  217. move-result p1
  218. if-eqz p1, :cond_1
  219. invoke-static {}, Lokhttp3/internal/platform/Platform;->get()Lokhttp3/internal/platform/Platform;
  220. move-result-object p1
  221. invoke-virtual {p1, v1}, Lokhttp3/internal/platform/Platform;->getSelectedProtocol(Ljavax/net/ssl/SSLSocket;)Ljava/lang/String;
  222. move-result-object v2
  223. :cond_1
  224. iput-object v1, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  225. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  226. invoke-static {p1}, Lokio/Okio;->source(Ljava/net/Socket;)Lokio/Source;
  227. move-result-object p1
  228. invoke-static {p1}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
  229. move-result-object p1
  230. iput-object p1, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  231. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  232. invoke-static {p1}, Lokio/Okio;->sink(Ljava/net/Socket;)Lokio/Sink;
  233. move-result-object p1
  234. invoke-static {p1}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink;
  235. move-result-object p1
  236. iput-object p1, p0, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  237. iput-object v3, p0, Lokhttp3/internal/connection/RealConnection;->handshake:Lokhttp3/Handshake;
  238. if-eqz v2, :cond_2
  239. invoke-static {v2}, Lokhttp3/Protocol;->get(Ljava/lang/String;)Lokhttp3/Protocol;
  240. move-result-object p1
  241. goto :goto_0
  242. :cond_2
  243. sget-object p1, Lokhttp3/Protocol;->HTTP_1_1:Lokhttp3/Protocol;
  244. :goto_0
  245. iput-object p1, p0, Lokhttp3/internal/connection/RealConnection;->protocol:Lokhttp3/Protocol;
  246. :try_end_1
  247. .catch Ljava/lang/AssertionError; {:try_start_1 .. :try_end_1} :catch_0
  248. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  249. if-eqz v1, :cond_3
  250. invoke-static {}, Lokhttp3/internal/platform/Platform;->get()Lokhttp3/internal/platform/Platform;
  251. move-result-object p1
  252. invoke-virtual {p1, v1}, Lokhttp3/internal/platform/Platform;->afterHandshake(Ljavax/net/ssl/SSLSocket;)V
  253. :cond_3
  254. return-void
  255. :cond_4
  256. :try_start_2
  257. invoke-virtual {v3}, Lokhttp3/Handshake;->peerCertificates()Ljava/util/List;
  258. move-result-object p1
  259. const/4 v2, 0x0
  260. invoke-interface {p1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
  261. move-result-object p1
  262. check-cast p1, Ljava/security/cert/X509Certificate;
  263. new-instance v2, Ljavax/net/ssl/SSLPeerUnverifiedException;
  264. new-instance v3, Ljava/lang/StringBuilder;
  265. invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
  266. const-string v4, "Hostname "
  267. invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  268. invoke-virtual {v0}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  269. move-result-object v0
  270. invoke-virtual {v0}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  271. move-result-object v0
  272. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  273. const-string v0, " not verified:\n certificate: "
  274. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  275. invoke-static {p1}, Lokhttp3/CertificatePinner;->pin(Ljava/security/cert/Certificate;)Ljava/lang/String;
  276. move-result-object v0
  277. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  278. const-string v0, "\n DN: "
  279. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  280. invoke-virtual {p1}, Ljava/security/cert/X509Certificate;->getSubjectDN()Ljava/security/Principal;
  281. move-result-object v0
  282. invoke-interface {v0}, Ljava/security/Principal;->getName()Ljava/lang/String;
  283. move-result-object v0
  284. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  285. const-string v0, "\n subjectAltNames: "
  286. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  287. invoke-static {p1}, Lokhttp3/internal/tls/OkHostnameVerifier;->allSubjectAltNames(Ljava/security/cert/X509Certificate;)Ljava/util/List;
  288. move-result-object p1
  289. invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  290. invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  291. move-result-object p1
  292. invoke-direct {v2, p1}, Ljavax/net/ssl/SSLPeerUnverifiedException;-><init>(Ljava/lang/String;)V
  293. throw v2
  294. :try_end_2
  295. .catch Ljava/lang/AssertionError; {:try_start_2 .. :try_end_2} :catch_0
  296. .catchall {:try_start_2 .. :try_end_2} :catchall_0
  297. :catchall_0
  298. move-exception p1
  299. goto :goto_2
  300. :catch_0
  301. move-exception p1
  302. move-object v2, v1
  303. goto :goto_1
  304. :catchall_1
  305. move-exception p1
  306. move-object v1, v2
  307. goto :goto_2
  308. :catch_1
  309. move-exception p1
  310. :goto_1
  311. :try_start_3
  312. invoke-static {p1}, Lokhttp3/internal/Util;->isAndroidGetsocknameError(Ljava/lang/AssertionError;)Z
  313. move-result v0
  314. if-eqz v0, :cond_5
  315. new-instance v0, Ljava/io/IOException;
  316. invoke-direct {v0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/Throwable;)V
  317. throw v0
  318. :cond_5
  319. throw p1
  320. :try_end_3
  321. .catchall {:try_start_3 .. :try_end_3} :catchall_1
  322. :goto_2
  323. if-eqz v1, :cond_6
  324. invoke-static {}, Lokhttp3/internal/platform/Platform;->get()Lokhttp3/internal/platform/Platform;
  325. move-result-object v0
  326. invoke-virtual {v0, v1}, Lokhttp3/internal/platform/Platform;->afterHandshake(Ljavax/net/ssl/SSLSocket;)V
  327. :cond_6
  328. invoke-static {v1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  329. throw p1
  330. .end method
  331. .method private connectTunnel(IIILokhttp3/Call;Lokhttp3/EventListener;)V
  332. .locals 6
  333. .annotation system Ldalvik/annotation/Throws;
  334. value = {
  335. Ljava/io/IOException;
  336. }
  337. .end annotation
  338. invoke-direct {p0}, Lokhttp3/internal/connection/RealConnection;->createTunnelRequest()Lokhttp3/Request;
  339. move-result-object v0
  340. invoke-virtual {v0}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  341. move-result-object v1
  342. const/4 v2, 0x0
  343. :goto_0
  344. const/16 v3, 0x15
  345. if-ge v2, v3, :cond_1
  346. invoke-direct {p0, p1, p2, p4, p5}, Lokhttp3/internal/connection/RealConnection;->connectSocket(IILokhttp3/Call;Lokhttp3/EventListener;)V
  347. invoke-direct {p0, p2, p3, v0, v1}, Lokhttp3/internal/connection/RealConnection;->createTunnel(IILokhttp3/Request;Lokhttp3/HttpUrl;)Lokhttp3/Request;
  348. move-result-object v0
  349. if-nez v0, :cond_0
  350. goto :goto_1
  351. :cond_0
  352. iget-object v3, p0, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  353. invoke-static {v3}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  354. const/4 v3, 0x0
  355. iput-object v3, p0, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  356. iput-object v3, p0, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  357. iput-object v3, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  358. iget-object v4, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  359. invoke-virtual {v4}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
  360. move-result-object v4
  361. iget-object v5, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  362. invoke-virtual {v5}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
  363. move-result-object v5
  364. invoke-virtual {p5, p4, v4, v5, v3}, Lokhttp3/EventListener;->connectEnd(Lokhttp3/Call;Ljava/net/InetSocketAddress;Ljava/net/Proxy;Lokhttp3/Protocol;)V
  365. add-int/lit8 v2, v2, 0x1
  366. goto :goto_0
  367. :cond_1
  368. :goto_1
  369. return-void
  370. .end method
  371. .method private createTunnel(IILokhttp3/Request;Lokhttp3/HttpUrl;)Lokhttp3/Request;
  372. .locals 7
  373. .annotation system Ldalvik/annotation/Throws;
  374. value = {
  375. Ljava/io/IOException;
  376. }
  377. .end annotation
  378. new-instance v0, Ljava/lang/StringBuilder;
  379. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  380. const-string v1, "CONNECT "
  381. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  382. const/4 v1, 0x1
  383. invoke-static {p4, v1}, Lokhttp3/internal/Util;->hostHeader(Lokhttp3/HttpUrl;Z)Ljava/lang/String;
  384. move-result-object p4
  385. invoke-virtual {v0, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  386. const-string p4, " HTTP/1.1"
  387. invoke-virtual {v0, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  388. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  389. move-result-object p4
  390. :goto_0
  391. new-instance v0, Lokhttp3/internal/http1/Http1Codec;
  392. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  393. iget-object v2, p0, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  394. const/4 v3, 0x0
  395. invoke-direct {v0, v3, v3, v1, v2}, Lokhttp3/internal/http1/Http1Codec;-><init>(Lokhttp3/OkHttpClient;Lokhttp3/internal/connection/StreamAllocation;Lokio/BufferedSource;Lokio/BufferedSink;)V
  396. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  397. invoke-interface {v1}, Lokio/Source;->timeout()Lokio/Timeout;
  398. move-result-object v1
  399. int-to-long v4, p1
  400. sget-object v2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
  401. invoke-virtual {v1, v4, v5, v2}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
  402. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  403. invoke-interface {v1}, Lokio/Sink;->timeout()Lokio/Timeout;
  404. move-result-object v1
  405. int-to-long v4, p2
  406. sget-object v2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
  407. invoke-virtual {v1, v4, v5, v2}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
  408. invoke-virtual {p3}, Lokhttp3/Request;->headers()Lokhttp3/Headers;
  409. move-result-object v1
  410. invoke-virtual {v0, v1, p4}, Lokhttp3/internal/http1/Http1Codec;->writeRequest(Lokhttp3/Headers;Ljava/lang/String;)V
  411. invoke-virtual {v0}, Lokhttp3/internal/http1/Http1Codec;->finishRequest()V
  412. const/4 v1, 0x0
  413. invoke-virtual {v0, v1}, Lokhttp3/internal/http1/Http1Codec;->readResponseHeaders(Z)Lokhttp3/Response$Builder;
  414. move-result-object v1
  415. invoke-virtual {v1, p3}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
  416. move-result-object p3
  417. invoke-virtual {p3}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
  418. move-result-object p3
  419. invoke-static {p3}, Lokhttp3/internal/http/HttpHeaders;->contentLength(Lokhttp3/Response;)J
  420. move-result-wide v1
  421. const-wide/16 v4, -0x1
  422. cmp-long v6, v1, v4
  423. if-nez v6, :cond_0
  424. const-wide/16 v1, 0x0
  425. :cond_0
  426. invoke-virtual {v0, v1, v2}, Lokhttp3/internal/http1/Http1Codec;->newFixedLengthSource(J)Lokio/Source;
  427. move-result-object v0
  428. const v1, 0x7fffffff
  429. sget-object v2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
  430. invoke-static {v0, v1, v2}, Lokhttp3/internal/Util;->skipAll(Lokio/Source;ILjava/util/concurrent/TimeUnit;)Z
  431. invoke-interface {v0}, Lokio/Source;->close()V
  432. invoke-virtual {p3}, Lokhttp3/Response;->code()I
  433. move-result v0
  434. const/16 v1, 0xc8
  435. if-eq v0, v1, :cond_4
  436. const/16 v1, 0x197
  437. if-ne v0, v1, :cond_3
  438. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  439. invoke-virtual {v0}, Lokhttp3/Route;->address()Lokhttp3/Address;
  440. move-result-object v0
  441. invoke-virtual {v0}, Lokhttp3/Address;->proxyAuthenticator()Lokhttp3/Authenticator;
  442. move-result-object v0
  443. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  444. invoke-interface {v0, v1, p3}, Lokhttp3/Authenticator;->authenticate(Lokhttp3/Route;Lokhttp3/Response;)Lokhttp3/Request;
  445. move-result-object v0
  446. if-eqz v0, :cond_2
  447. const-string v1, "Connection"
  448. invoke-virtual {p3, v1}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
  449. move-result-object p3
  450. const-string v1, "close"
  451. invoke-virtual {v1, p3}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
  452. move-result p3
  453. if-eqz p3, :cond_1
  454. return-object v0
  455. :cond_1
  456. move-object p3, v0
  457. goto/16 :goto_0
  458. :cond_2
  459. new-instance p1, Ljava/io/IOException;
  460. const-string p2, "Failed to authenticate with proxy"
  461. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  462. throw p1
  463. :cond_3
  464. new-instance p1, Ljava/io/IOException;
  465. new-instance p2, Ljava/lang/StringBuilder;
  466. invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
  467. const-string p4, "Unexpected response code for CONNECT: "
  468. invoke-virtual {p2, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  469. invoke-virtual {p3}, Lokhttp3/Response;->code()I
  470. move-result p3
  471. invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  472. invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  473. move-result-object p2
  474. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  475. throw p1
  476. :cond_4
  477. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  478. invoke-interface {p1}, Lokio/BufferedSource;->buffer()Lokio/Buffer;
  479. move-result-object p1
  480. invoke-virtual {p1}, Lokio/Buffer;->exhausted()Z
  481. move-result p1
  482. if-eqz p1, :cond_5
  483. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  484. invoke-interface {p1}, Lokio/BufferedSink;->buffer()Lokio/Buffer;
  485. move-result-object p1
  486. invoke-virtual {p1}, Lokio/Buffer;->exhausted()Z
  487. move-result p1
  488. if-eqz p1, :cond_5
  489. return-object v3
  490. :cond_5
  491. new-instance p1, Ljava/io/IOException;
  492. const-string p2, "TLS tunnel buffered too many bytes!"
  493. invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  494. goto :goto_2
  495. :goto_1
  496. throw p1
  497. :goto_2
  498. goto :goto_1
  499. .end method
  500. .method private createTunnelRequest()Lokhttp3/Request;
  501. .locals 3
  502. new-instance v0, Lokhttp3/Request$Builder;
  503. invoke-direct {v0}, Lokhttp3/Request$Builder;-><init>()V
  504. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  505. invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
  506. move-result-object v1
  507. invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  508. move-result-object v1
  509. invoke-virtual {v0, v1}, Lokhttp3/Request$Builder;->url(Lokhttp3/HttpUrl;)Lokhttp3/Request$Builder;
  510. move-result-object v0
  511. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  512. invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
  513. move-result-object v1
  514. invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  515. move-result-object v1
  516. const/4 v2, 0x1
  517. invoke-static {v1, v2}, Lokhttp3/internal/Util;->hostHeader(Lokhttp3/HttpUrl;Z)Ljava/lang/String;
  518. move-result-object v1
  519. const-string v2, "Host"
  520. invoke-virtual {v0, v2, v1}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
  521. move-result-object v0
  522. const-string v1, "Proxy-Connection"
  523. const-string v2, "Keep-Alive"
  524. invoke-virtual {v0, v1, v2}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
  525. move-result-object v0
  526. invoke-static {}, Lokhttp3/internal/Version;->userAgent()Ljava/lang/String;
  527. move-result-object v1
  528. const-string v2, "User-Agent"
  529. invoke-virtual {v0, v2, v1}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
  530. move-result-object v0
  531. invoke-virtual {v0}, Lokhttp3/Request$Builder;->build()Lokhttp3/Request;
  532. move-result-object v0
  533. return-object v0
  534. .end method
  535. .method private establishProtocol(Lokhttp3/internal/connection/ConnectionSpecSelector;Lokhttp3/Call;Lokhttp3/EventListener;)V
  536. .locals 2
  537. .annotation system Ldalvik/annotation/Throws;
  538. value = {
  539. Ljava/io/IOException;
  540. }
  541. .end annotation
  542. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  543. invoke-virtual {v0}, Lokhttp3/Route;->address()Lokhttp3/Address;
  544. move-result-object v0
  545. invoke-virtual {v0}, Lokhttp3/Address;->sslSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
  546. move-result-object v0
  547. if-nez v0, :cond_0
  548. sget-object p1, Lokhttp3/Protocol;->HTTP_1_1:Lokhttp3/Protocol;
  549. iput-object p1, p0, Lokhttp3/internal/connection/RealConnection;->protocol:Lokhttp3/Protocol;
  550. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  551. iput-object p1, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  552. return-void
  553. :cond_0
  554. invoke-virtual {p3, p2}, Lokhttp3/EventListener;->secureConnectStart(Lokhttp3/Call;)V
  555. invoke-direct {p0, p1}, Lokhttp3/internal/connection/RealConnection;->connectTls(Lokhttp3/internal/connection/ConnectionSpecSelector;)V
  556. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->handshake:Lokhttp3/Handshake;
  557. invoke-virtual {p3, p2, p1}, Lokhttp3/EventListener;->secureConnectEnd(Lokhttp3/Call;Lokhttp3/Handshake;)V
  558. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->protocol:Lokhttp3/Protocol;
  559. sget-object p2, Lokhttp3/Protocol;->HTTP_2:Lokhttp3/Protocol;
  560. if-ne p1, p2, :cond_1
  561. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  562. const/4 p2, 0x0
  563. invoke-virtual {p1, p2}, Ljava/net/Socket;->setSoTimeout(I)V
  564. new-instance p1, Lokhttp3/internal/http2/Http2Connection$Builder;
  565. const/4 p2, 0x1
  566. invoke-direct {p1, p2}, Lokhttp3/internal/http2/Http2Connection$Builder;-><init>(Z)V
  567. iget-object p2, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  568. iget-object p3, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  569. invoke-virtual {p3}, Lokhttp3/Route;->address()Lokhttp3/Address;
  570. move-result-object p3
  571. invoke-virtual {p3}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  572. move-result-object p3
  573. invoke-virtual {p3}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  574. move-result-object p3
  575. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  576. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  577. invoke-virtual {p1, p2, p3, v0, v1}, Lokhttp3/internal/http2/Http2Connection$Builder;->socket(Ljava/net/Socket;Ljava/lang/String;Lokio/BufferedSource;Lokio/BufferedSink;)Lokhttp3/internal/http2/Http2Connection$Builder;
  578. move-result-object p1
  579. invoke-virtual {p1, p0}, Lokhttp3/internal/http2/Http2Connection$Builder;->listener(Lokhttp3/internal/http2/Http2Connection$Listener;)Lokhttp3/internal/http2/Http2Connection$Builder;
  580. move-result-object p1
  581. invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Connection$Builder;->build()Lokhttp3/internal/http2/Http2Connection;
  582. move-result-object p1
  583. iput-object p1, p0, Lokhttp3/internal/connection/RealConnection;->http2Connection:Lokhttp3/internal/http2/Http2Connection;
  584. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->http2Connection:Lokhttp3/internal/http2/Http2Connection;
  585. invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Connection;->start()V
  586. :cond_1
  587. return-void
  588. .end method
  589. .method public static testConnection(Lokhttp3/ConnectionPool;Lokhttp3/Route;Ljava/net/Socket;J)Lokhttp3/internal/connection/RealConnection;
  590. .locals 1
  591. new-instance v0, Lokhttp3/internal/connection/RealConnection;
  592. invoke-direct {v0, p0, p1}, Lokhttp3/internal/connection/RealConnection;-><init>(Lokhttp3/ConnectionPool;Lokhttp3/Route;)V
  593. iput-object p2, v0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  594. iput-wide p3, v0, Lokhttp3/internal/connection/RealConnection;->idleAtNanos:J
  595. return-object v0
  596. .end method
  597. # virtual methods
  598. .method public cancel()V
  599. .locals 1
  600. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  601. invoke-static {v0}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  602. return-void
  603. .end method
  604. .method public connect(IIIZLokhttp3/Call;Lokhttp3/EventListener;)V
  605. .locals 15
  606. move-object v7, p0
  607. move-object/from16 v8, p5
  608. move-object/from16 v9, p6
  609. iget-object v0, v7, Lokhttp3/internal/connection/RealConnection;->protocol:Lokhttp3/Protocol;
  610. if-nez v0, :cond_a
  611. iget-object v0, v7, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  612. invoke-virtual {v0}, Lokhttp3/Route;->address()Lokhttp3/Address;
  613. move-result-object v0
  614. invoke-virtual {v0}, Lokhttp3/Address;->connectionSpecs()Ljava/util/List;
  615. move-result-object v0
  616. new-instance v10, Lokhttp3/internal/connection/ConnectionSpecSelector;
  617. invoke-direct {v10, v0}, Lokhttp3/internal/connection/ConnectionSpecSelector;-><init>(Ljava/util/List;)V
  618. iget-object v1, v7, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  619. invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
  620. move-result-object v1
  621. invoke-virtual {v1}, Lokhttp3/Address;->sslSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
  622. move-result-object v1
  623. if-nez v1, :cond_2
  624. sget-object v1, Lokhttp3/ConnectionSpec;->CLEARTEXT:Lokhttp3/ConnectionSpec;
  625. invoke-interface {v0, v1}, Ljava/util/List;->contains(Ljava/lang/Object;)Z
  626. move-result v0
  627. if-eqz v0, :cond_1
  628. iget-object v0, v7, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  629. invoke-virtual {v0}, Lokhttp3/Route;->address()Lokhttp3/Address;
  630. move-result-object v0
  631. invoke-virtual {v0}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  632. move-result-object v0
  633. invoke-virtual {v0}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  634. move-result-object v0
  635. invoke-static {}, Lokhttp3/internal/platform/Platform;->get()Lokhttp3/internal/platform/Platform;
  636. move-result-object v1
  637. invoke-virtual {v1, v0}, Lokhttp3/internal/platform/Platform;->isCleartextTrafficPermitted(Ljava/lang/String;)Z
  638. move-result v1
  639. if-eqz v1, :cond_0
  640. goto :goto_0
  641. :cond_0
  642. new-instance v1, Lokhttp3/internal/connection/RouteException;
  643. new-instance v2, Ljava/net/UnknownServiceException;
  644. new-instance v3, Ljava/lang/StringBuilder;
  645. invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
  646. const-string v4, "CLEARTEXT communication to "
  647. invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  648. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  649. const-string v0, " not permitted by network security policy"
  650. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  651. invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  652. move-result-object v0
  653. invoke-direct {v2, v0}, Ljava/net/UnknownServiceException;-><init>(Ljava/lang/String;)V
  654. invoke-direct {v1, v2}, Lokhttp3/internal/connection/RouteException;-><init>(Ljava/io/IOException;)V
  655. throw v1
  656. :cond_1
  657. new-instance v0, Lokhttp3/internal/connection/RouteException;
  658. new-instance v1, Ljava/net/UnknownServiceException;
  659. const-string v2, "CLEARTEXT communication not enabled for client"
  660. invoke-direct {v1, v2}, Ljava/net/UnknownServiceException;-><init>(Ljava/lang/String;)V
  661. invoke-direct {v0, v1}, Lokhttp3/internal/connection/RouteException;-><init>(Ljava/io/IOException;)V
  662. throw v0
  663. :cond_2
  664. :goto_0
  665. const/4 v11, 0x0
  666. move-object v12, v11
  667. :goto_1
  668. :try_start_0
  669. iget-object v0, v7, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  670. invoke-virtual {v0}, Lokhttp3/Route;->requiresTunnel()Z
  671. move-result v0
  672. if-eqz v0, :cond_4
  673. move-object v1, p0
  674. move/from16 v2, p1
  675. move/from16 v3, p2
  676. move/from16 v4, p3
  677. move-object/from16 v5, p5
  678. move-object/from16 v6, p6
  679. invoke-direct/range {v1 .. v6}, Lokhttp3/internal/connection/RealConnection;->connectTunnel(IIILokhttp3/Call;Lokhttp3/EventListener;)V
  680. iget-object v0, v7, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  681. :try_end_0
  682. .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1
  683. if-nez v0, :cond_3
  684. goto :goto_3
  685. :cond_3
  686. move/from16 v13, p1
  687. move/from16 v14, p2
  688. goto :goto_2
  689. :cond_4
  690. move/from16 v13, p1
  691. move/from16 v14, p2
  692. :try_start_1
  693. invoke-direct {p0, v13, v14, v8, v9}, Lokhttp3/internal/connection/RealConnection;->connectSocket(IILokhttp3/Call;Lokhttp3/EventListener;)V
  694. :goto_2
  695. invoke-direct {p0, v10, v8, v9}, Lokhttp3/internal/connection/RealConnection;->establishProtocol(Lokhttp3/internal/connection/ConnectionSpecSelector;Lokhttp3/Call;Lokhttp3/EventListener;)V
  696. iget-object v0, v7, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  697. invoke-virtual {v0}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
  698. move-result-object v0
  699. iget-object v1, v7, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  700. invoke-virtual {v1}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
  701. move-result-object v1
  702. iget-object v2, v7, Lokhttp3/internal/connection/RealConnection;->protocol:Lokhttp3/Protocol;
  703. invoke-virtual {v9, v8, v0, v1, v2}, Lokhttp3/EventListener;->connectEnd(Lokhttp3/Call;Ljava/net/InetSocketAddress;Ljava/net/Proxy;Lokhttp3/Protocol;)V
  704. :try_end_1
  705. .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
  706. :goto_3
  707. iget-object v0, v7, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  708. invoke-virtual {v0}, Lokhttp3/Route;->requiresTunnel()Z
  709. move-result v0
  710. if-eqz v0, :cond_6
  711. iget-object v0, v7, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  712. if-eqz v0, :cond_5
  713. goto :goto_4
  714. :cond_5
  715. new-instance v0, Ljava/net/ProtocolException;
  716. const-string v1, "Too many tunnel connections attempted: 21"
  717. invoke-direct {v0, v1}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
  718. new-instance v1, Lokhttp3/internal/connection/RouteException;
  719. invoke-direct {v1, v0}, Lokhttp3/internal/connection/RouteException;-><init>(Ljava/io/IOException;)V
  720. throw v1
  721. :cond_6
  722. :goto_4
  723. iget-object v0, v7, Lokhttp3/internal/connection/RealConnection;->http2Connection:Lokhttp3/internal/http2/Http2Connection;
  724. if-eqz v0, :cond_7
  725. iget-object v1, v7, Lokhttp3/internal/connection/RealConnection;->connectionPool:Lokhttp3/ConnectionPool;
  726. monitor-enter v1
  727. :try_start_2
  728. iget-object v0, v7, Lokhttp3/internal/connection/RealConnection;->http2Connection:Lokhttp3/internal/http2/Http2Connection;
  729. invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Connection;->maxConcurrentStreams()I
  730. move-result v0
  731. iput v0, v7, Lokhttp3/internal/connection/RealConnection;->allocationLimit:I
  732. monitor-exit v1
  733. goto :goto_5
  734. :catchall_0
  735. move-exception v0
  736. monitor-exit v1
  737. :try_end_2
  738. .catchall {:try_start_2 .. :try_end_2} :catchall_0
  739. throw v0
  740. :cond_7
  741. :goto_5
  742. return-void
  743. :catch_0
  744. move-exception v0
  745. goto :goto_6
  746. :catch_1
  747. move-exception v0
  748. move/from16 v13, p1
  749. move/from16 v14, p2
  750. :goto_6
  751. iget-object v1, v7, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  752. invoke-static {v1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  753. iget-object v1, v7, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  754. invoke-static {v1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  755. iput-object v11, v7, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  756. iput-object v11, v7, Lokhttp3/internal/connection/RealConnection;->rawSocket:Ljava/net/Socket;
  757. iput-object v11, v7, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  758. iput-object v11, v7, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  759. iput-object v11, v7, Lokhttp3/internal/connection/RealConnection;->handshake:Lokhttp3/Handshake;
  760. iput-object v11, v7, Lokhttp3/internal/connection/RealConnection;->protocol:Lokhttp3/Protocol;
  761. iput-object v11, v7, Lokhttp3/internal/connection/RealConnection;->http2Connection:Lokhttp3/internal/http2/Http2Connection;
  762. iget-object v1, v7, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  763. invoke-virtual {v1}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
  764. move-result-object v3
  765. iget-object v1, v7, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  766. invoke-virtual {v1}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
  767. move-result-object v4
  768. const/4 v5, 0x0
  769. move-object/from16 v1, p6
  770. move-object/from16 v2, p5
  771. move-object v6, v0
  772. invoke-virtual/range {v1 .. v6}, Lokhttp3/EventListener;->connectFailed(Lokhttp3/Call;Ljava/net/InetSocketAddress;Ljava/net/Proxy;Lokhttp3/Protocol;Ljava/io/IOException;)V
  773. if-nez v12, :cond_8
  774. new-instance v1, Lokhttp3/internal/connection/RouteException;
  775. invoke-direct {v1, v0}, Lokhttp3/internal/connection/RouteException;-><init>(Ljava/io/IOException;)V
  776. move-object v12, v1
  777. goto :goto_7
  778. :cond_8
  779. invoke-virtual {v12, v0}, Lokhttp3/internal/connection/RouteException;->addConnectException(Ljava/io/IOException;)V
  780. :goto_7
  781. if-eqz p4, :cond_9
  782. invoke-virtual {v10, v0}, Lokhttp3/internal/connection/ConnectionSpecSelector;->connectionFailed(Ljava/io/IOException;)Z
  783. move-result v0
  784. if-eqz v0, :cond_9
  785. goto/16 :goto_1
  786. :cond_9
  787. throw v12
  788. :cond_a
  789. new-instance v0, Ljava/lang/IllegalStateException;
  790. const-string v1, "already connected"
  791. invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  792. goto :goto_9
  793. :goto_8
  794. throw v0
  795. :goto_9
  796. goto :goto_8
  797. .end method
  798. .method public handshake()Lokhttp3/Handshake;
  799. .locals 1
  800. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->handshake:Lokhttp3/Handshake;
  801. return-object v0
  802. .end method
  803. .method public isEligible(Lokhttp3/Address;Lokhttp3/Route;)Z
  804. .locals 4
  805. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->allocations:Ljava/util/List;
  806. invoke-interface {v0}, Ljava/util/List;->size()I
  807. move-result v0
  808. iget v1, p0, Lokhttp3/internal/connection/RealConnection;->allocationLimit:I
  809. const/4 v2, 0x0
  810. if-ge v0, v1, :cond_a
  811. iget-boolean v0, p0, Lokhttp3/internal/connection/RealConnection;->noNewStreams:Z
  812. if-eqz v0, :cond_0
  813. goto/16 :goto_0
  814. :cond_0
  815. sget-object v0, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
  816. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  817. invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
  818. move-result-object v1
  819. invoke-virtual {v0, v1, p1}, Lokhttp3/internal/Internal;->equalsNonHost(Lokhttp3/Address;Lokhttp3/Address;)Z
  820. move-result v0
  821. if-nez v0, :cond_1
  822. return v2
  823. :cond_1
  824. invoke-virtual {p1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  825. move-result-object v0
  826. invoke-virtual {v0}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  827. move-result-object v0
  828. invoke-virtual {p0}, Lokhttp3/internal/connection/RealConnection;->route()Lokhttp3/Route;
  829. move-result-object v1
  830. invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
  831. move-result-object v1
  832. invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  833. move-result-object v1
  834. invoke-virtual {v1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  835. move-result-object v1
  836. invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
  837. move-result v0
  838. const/4 v1, 0x1
  839. if-eqz v0, :cond_2
  840. return v1
  841. :cond_2
  842. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->http2Connection:Lokhttp3/internal/http2/Http2Connection;
  843. if-nez v0, :cond_3
  844. return v2
  845. :cond_3
  846. if-nez p2, :cond_4
  847. return v2
  848. :cond_4
  849. invoke-virtual {p2}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
  850. move-result-object v0
  851. invoke-virtual {v0}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
  852. move-result-object v0
  853. sget-object v3, Ljava/net/Proxy$Type;->DIRECT:Ljava/net/Proxy$Type;
  854. if-eq v0, v3, :cond_5
  855. return v2
  856. :cond_5
  857. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  858. invoke-virtual {v0}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
  859. move-result-object v0
  860. invoke-virtual {v0}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
  861. move-result-object v0
  862. sget-object v3, Ljava/net/Proxy$Type;->DIRECT:Ljava/net/Proxy$Type;
  863. if-eq v0, v3, :cond_6
  864. return v2
  865. :cond_6
  866. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  867. invoke-virtual {v0}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
  868. move-result-object v0
  869. invoke-virtual {p2}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
  870. move-result-object v3
  871. invoke-virtual {v0, v3}, Ljava/net/InetSocketAddress;->equals(Ljava/lang/Object;)Z
  872. move-result v0
  873. if-nez v0, :cond_7
  874. return v2
  875. :cond_7
  876. invoke-virtual {p2}, Lokhttp3/Route;->address()Lokhttp3/Address;
  877. move-result-object p2
  878. invoke-virtual {p2}, Lokhttp3/Address;->hostnameVerifier()Ljavax/net/ssl/HostnameVerifier;
  879. move-result-object p2
  880. sget-object v0, Lokhttp3/internal/tls/OkHostnameVerifier;->INSTANCE:Lokhttp3/internal/tls/OkHostnameVerifier;
  881. if-eq p2, v0, :cond_8
  882. return v2
  883. :cond_8
  884. invoke-virtual {p1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  885. move-result-object p2
  886. invoke-virtual {p0, p2}, Lokhttp3/internal/connection/RealConnection;->supportsUrl(Lokhttp3/HttpUrl;)Z
  887. move-result p2
  888. if-nez p2, :cond_9
  889. return v2
  890. :cond_9
  891. :try_start_0
  892. invoke-virtual {p1}, Lokhttp3/Address;->certificatePinner()Lokhttp3/CertificatePinner;
  893. move-result-object p2
  894. invoke-virtual {p1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  895. move-result-object p1
  896. invoke-virtual {p1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  897. move-result-object p1
  898. invoke-virtual {p0}, Lokhttp3/internal/connection/RealConnection;->handshake()Lokhttp3/Handshake;
  899. move-result-object v0
  900. invoke-virtual {v0}, Lokhttp3/Handshake;->peerCertificates()Ljava/util/List;
  901. move-result-object v0
  902. invoke-virtual {p2, p1, v0}, Lokhttp3/CertificatePinner;->check(Ljava/lang/String;Ljava/util/List;)V
  903. :try_end_0
  904. .catch Ljavax/net/ssl/SSLPeerUnverifiedException; {:try_start_0 .. :try_end_0} :catch_0
  905. return v1
  906. :catch_0
  907. :cond_a
  908. :goto_0
  909. return v2
  910. .end method
  911. .method public isHealthy(Z)Z
  912. .locals 4
  913. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  914. invoke-virtual {v0}, Ljava/net/Socket;->isClosed()Z
  915. move-result v0
  916. const/4 v1, 0x0
  917. if-nez v0, :cond_4
  918. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  919. invoke-virtual {v0}, Ljava/net/Socket;->isInputShutdown()Z
  920. move-result v0
  921. if-nez v0, :cond_4
  922. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  923. invoke-virtual {v0}, Ljava/net/Socket;->isOutputShutdown()Z
  924. move-result v0
  925. if-eqz v0, :cond_0
  926. goto :goto_0
  927. :cond_0
  928. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->http2Connection:Lokhttp3/internal/http2/Http2Connection;
  929. const/4 v2, 0x1
  930. if-eqz v0, :cond_1
  931. invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Connection;->isShutdown()Z
  932. move-result p1
  933. xor-int/2addr p1, v2
  934. return p1
  935. :cond_1
  936. if-eqz p1, :cond_3
  937. :try_start_0
  938. iget-object p1, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  939. invoke-virtual {p1}, Ljava/net/Socket;->getSoTimeout()I
  940. move-result p1
  941. :try_end_0
  942. .catch Ljava/net/SocketTimeoutException; {:try_start_0 .. :try_end_0} :catch_1
  943. .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
  944. :try_start_1
  945. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  946. invoke-virtual {v0, v2}, Ljava/net/Socket;->setSoTimeout(I)V
  947. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  948. invoke-interface {v0}, Lokio/BufferedSource;->exhausted()Z
  949. move-result v0
  950. :try_end_1
  951. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  952. if-eqz v0, :cond_2
  953. :try_start_2
  954. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  955. invoke-virtual {v0, p1}, Ljava/net/Socket;->setSoTimeout(I)V
  956. return v1
  957. :cond_2
  958. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  959. invoke-virtual {v0, p1}, Ljava/net/Socket;->setSoTimeout(I)V
  960. return v2
  961. :catchall_0
  962. move-exception v0
  963. iget-object v3, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  964. invoke-virtual {v3, p1}, Ljava/net/Socket;->setSoTimeout(I)V
  965. throw v0
  966. :try_end_2
  967. .catch Ljava/net/SocketTimeoutException; {:try_start_2 .. :try_end_2} :catch_1
  968. .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
  969. :catch_0
  970. return v1
  971. :catch_1
  972. :cond_3
  973. return v2
  974. :cond_4
  975. :goto_0
  976. return v1
  977. .end method
  978. .method public isMultiplexed()Z
  979. .locals 1
  980. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->http2Connection:Lokhttp3/internal/http2/Http2Connection;
  981. if-eqz v0, :cond_0
  982. const/4 v0, 0x1
  983. goto :goto_0
  984. :cond_0
  985. const/4 v0, 0x0
  986. :goto_0
  987. return v0
  988. .end method
  989. .method public newCodec(Lokhttp3/OkHttpClient;Lokhttp3/Interceptor$Chain;Lokhttp3/internal/connection/StreamAllocation;)Lokhttp3/internal/http/HttpCodec;
  990. .locals 4
  991. .annotation system Ldalvik/annotation/Throws;
  992. value = {
  993. Ljava/net/SocketException;
  994. }
  995. .end annotation
  996. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->http2Connection:Lokhttp3/internal/http2/Http2Connection;
  997. if-eqz v0, :cond_0
  998. new-instance v1, Lokhttp3/internal/http2/Http2Codec;
  999. invoke-direct {v1, p1, p2, p3, v0}, Lokhttp3/internal/http2/Http2Codec;-><init>(Lokhttp3/OkHttpClient;Lokhttp3/Interceptor$Chain;Lokhttp3/internal/connection/StreamAllocation;Lokhttp3/internal/http2/Http2Connection;)V
  1000. return-object v1
  1001. :cond_0
  1002. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  1003. invoke-interface {p2}, Lokhttp3/Interceptor$Chain;->readTimeoutMillis()I
  1004. move-result v1
  1005. invoke-virtual {v0, v1}, Ljava/net/Socket;->setSoTimeout(I)V
  1006. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  1007. invoke-interface {v0}, Lokio/Source;->timeout()Lokio/Timeout;
  1008. move-result-object v0
  1009. invoke-interface {p2}, Lokhttp3/Interceptor$Chain;->readTimeoutMillis()I
  1010. move-result v1
  1011. int-to-long v1, v1
  1012. sget-object v3, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
  1013. invoke-virtual {v0, v1, v2, v3}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
  1014. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  1015. invoke-interface {v0}, Lokio/Sink;->timeout()Lokio/Timeout;
  1016. move-result-object v0
  1017. invoke-interface {p2}, Lokhttp3/Interceptor$Chain;->writeTimeoutMillis()I
  1018. move-result p2
  1019. int-to-long v1, p2
  1020. sget-object p2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
  1021. invoke-virtual {v0, v1, v2, p2}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
  1022. new-instance p2, Lokhttp3/internal/http1/Http1Codec;
  1023. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  1024. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  1025. invoke-direct {p2, p1, p3, v0, v1}, Lokhttp3/internal/http1/Http1Codec;-><init>(Lokhttp3/OkHttpClient;Lokhttp3/internal/connection/StreamAllocation;Lokio/BufferedSource;Lokio/BufferedSink;)V
  1026. return-object p2
  1027. .end method
  1028. .method public newWebSocketStreams(Lokhttp3/internal/connection/StreamAllocation;)Lokhttp3/internal/ws/RealWebSocket$Streams;
  1029. .locals 7
  1030. new-instance v6, Lokhttp3/internal/connection/RealConnection$1;
  1031. iget-object v3, p0, Lokhttp3/internal/connection/RealConnection;->source:Lokio/BufferedSource;
  1032. iget-object v4, p0, Lokhttp3/internal/connection/RealConnection;->sink:Lokio/BufferedSink;
  1033. const/4 v2, 0x1
  1034. move-object v0, v6
  1035. move-object v1, p0
  1036. move-object v5, p1
  1037. invoke-direct/range {v0 .. v5}, Lokhttp3/internal/connection/RealConnection$1;-><init>(Lokhttp3/internal/connection/RealConnection;ZLokio/BufferedSource;Lokio/BufferedSink;Lokhttp3/internal/connection/StreamAllocation;)V
  1038. return-object v6
  1039. .end method
  1040. .method public onSettings(Lokhttp3/internal/http2/Http2Connection;)V
  1041. .locals 1
  1042. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->connectionPool:Lokhttp3/ConnectionPool;
  1043. monitor-enter v0
  1044. :try_start_0
  1045. invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Connection;->maxConcurrentStreams()I
  1046. move-result p1
  1047. iput p1, p0, Lokhttp3/internal/connection/RealConnection;->allocationLimit:I
  1048. monitor-exit v0
  1049. return-void
  1050. :catchall_0
  1051. move-exception p1
  1052. monitor-exit v0
  1053. :try_end_0
  1054. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  1055. throw p1
  1056. .end method
  1057. .method public onStream(Lokhttp3/internal/http2/Http2Stream;)V
  1058. .locals 1
  1059. .annotation system Ldalvik/annotation/Throws;
  1060. value = {
  1061. Ljava/io/IOException;
  1062. }
  1063. .end annotation
  1064. sget-object v0, Lokhttp3/internal/http2/ErrorCode;->REFUSED_STREAM:Lokhttp3/internal/http2/ErrorCode;
  1065. invoke-virtual {p1, v0}, Lokhttp3/internal/http2/Http2Stream;->close(Lokhttp3/internal/http2/ErrorCode;)V
  1066. return-void
  1067. .end method
  1068. .method public protocol()Lokhttp3/Protocol;
  1069. .locals 1
  1070. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->protocol:Lokhttp3/Protocol;
  1071. return-object v0
  1072. .end method
  1073. .method public route()Lokhttp3/Route;
  1074. .locals 1
  1075. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  1076. return-object v0
  1077. .end method
  1078. .method public socket()Ljava/net/Socket;
  1079. .locals 1
  1080. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->socket:Ljava/net/Socket;
  1081. return-object v0
  1082. .end method
  1083. .method public supportsUrl(Lokhttp3/HttpUrl;)Z
  1084. .locals 4
  1085. invoke-virtual {p1}, Lokhttp3/HttpUrl;->port()I
  1086. move-result v0
  1087. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  1088. invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
  1089. move-result-object v1
  1090. invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  1091. move-result-object v1
  1092. invoke-virtual {v1}, Lokhttp3/HttpUrl;->port()I
  1093. move-result v1
  1094. const/4 v2, 0x0
  1095. if-eq v0, v1, :cond_0
  1096. return v2
  1097. :cond_0
  1098. invoke-virtual {p1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  1099. move-result-object v0
  1100. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  1101. invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
  1102. move-result-object v1
  1103. invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  1104. move-result-object v1
  1105. invoke-virtual {v1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  1106. move-result-object v1
  1107. invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
  1108. move-result v0
  1109. const/4 v1, 0x1
  1110. if-nez v0, :cond_2
  1111. iget-object v0, p0, Lokhttp3/internal/connection/RealConnection;->handshake:Lokhttp3/Handshake;
  1112. if-eqz v0, :cond_1
  1113. sget-object v0, Lokhttp3/internal/tls/OkHostnameVerifier;->INSTANCE:Lokhttp3/internal/tls/OkHostnameVerifier;
  1114. invoke-virtual {p1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  1115. move-result-object p1
  1116. iget-object v3, p0, Lokhttp3/internal/connection/RealConnection;->handshake:Lokhttp3/Handshake;
  1117. invoke-virtual {v3}, Lokhttp3/Handshake;->peerCertificates()Ljava/util/List;
  1118. move-result-object v3
  1119. invoke-interface {v3, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
  1120. move-result-object v3
  1121. check-cast v3, Ljava/security/cert/X509Certificate;
  1122. invoke-virtual {v0, p1, v3}, Lokhttp3/internal/tls/OkHostnameVerifier;->verify(Ljava/lang/String;Ljava/security/cert/X509Certificate;)Z
  1123. move-result p1
  1124. if-eqz p1, :cond_1
  1125. goto :goto_0
  1126. :cond_1
  1127. const/4 v1, 0x0
  1128. :cond_2
  1129. :goto_0
  1130. return v1
  1131. .end method
  1132. .method public toString()Ljava/lang/String;
  1133. .locals 2
  1134. new-instance v0, Ljava/lang/StringBuilder;
  1135. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  1136. const-string v1, "Connection{"
  1137. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1138. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  1139. invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
  1140. move-result-object v1
  1141. invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  1142. move-result-object v1
  1143. invoke-virtual {v1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  1144. move-result-object v1
  1145. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1146. const-string v1, ":"
  1147. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1148. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  1149. invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
  1150. move-result-object v1
  1151. invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
  1152. move-result-object v1
  1153. invoke-virtual {v1}, Lokhttp3/HttpUrl;->port()I
  1154. move-result v1
  1155. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  1156. const-string v1, ", proxy="
  1157. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1158. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  1159. invoke-virtual {v1}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
  1160. move-result-object v1
  1161. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  1162. const-string v1, " hostAddress="
  1163. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1164. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->route:Lokhttp3/Route;
  1165. invoke-virtual {v1}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
  1166. move-result-object v1
  1167. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  1168. const-string v1, " cipherSuite="
  1169. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1170. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->handshake:Lokhttp3/Handshake;
  1171. if-eqz v1, :cond_0
  1172. invoke-virtual {v1}, Lokhttp3/Handshake;->cipherSuite()Lokhttp3/CipherSuite;
  1173. move-result-object v1
  1174. goto :goto_0
  1175. :cond_0
  1176. const-string v1, "none"
  1177. :goto_0
  1178. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  1179. const-string v1, " protocol="
  1180. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  1181. iget-object v1, p0, Lokhttp3/internal/connection/RealConnection;->protocol:Lokhttp3/Protocol;
  1182. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  1183. const/16 v1, 0x7d
  1184. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
  1185. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  1186. move-result-object v0
  1187. return-object v0
  1188. .end method