JdkWithJettyBootPlatform.smali 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. .class Lokhttp3/internal/platform/JdkWithJettyBootPlatform;
  2. .super Lokhttp3/internal/platform/Platform;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/MemberClasses;
  6. value = {
  7. Lokhttp3/internal/platform/JdkWithJettyBootPlatform$JettyNegoProvider;
  8. }
  9. .end annotation
  10. # instance fields
  11. .field private final clientProviderClass:Ljava/lang/Class;
  12. .annotation system Ldalvik/annotation/Signature;
  13. value = {
  14. "Ljava/lang/Class<",
  15. "*>;"
  16. }
  17. .end annotation
  18. .end field
  19. .field private final getMethod:Ljava/lang/reflect/Method;
  20. .field private final putMethod:Ljava/lang/reflect/Method;
  21. .field private final removeMethod:Ljava/lang/reflect/Method;
  22. .field private final serverProviderClass:Ljava/lang/Class;
  23. .annotation system Ldalvik/annotation/Signature;
  24. value = {
  25. "Ljava/lang/Class<",
  26. "*>;"
  27. }
  28. .end annotation
  29. .end field
  30. # direct methods
  31. .method constructor <init>(Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;Ljava/lang/Class;Ljava/lang/Class;)V
  32. .locals 0
  33. .annotation system Ldalvik/annotation/Signature;
  34. value = {
  35. "(",
  36. "Ljava/lang/reflect/Method;",
  37. "Ljava/lang/reflect/Method;",
  38. "Ljava/lang/reflect/Method;",
  39. "Ljava/lang/Class<",
  40. "*>;",
  41. "Ljava/lang/Class<",
  42. "*>;)V"
  43. }
  44. .end annotation
  45. invoke-direct {p0}, Lokhttp3/internal/platform/Platform;-><init>()V
  46. iput-object p1, p0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;->putMethod:Ljava/lang/reflect/Method;
  47. iput-object p2, p0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;->getMethod:Ljava/lang/reflect/Method;
  48. iput-object p3, p0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;->removeMethod:Ljava/lang/reflect/Method;
  49. iput-object p4, p0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;->clientProviderClass:Ljava/lang/Class;
  50. iput-object p5, p0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;->serverProviderClass:Ljava/lang/Class;
  51. return-void
  52. .end method
  53. .method public static buildIfSupported()Lokhttp3/internal/platform/Platform;
  54. .locals 10
  55. :try_start_0
  56. const-string v0, "org.eclipse.jetty.alpn.ALPN"
  57. :try_end_0
  58. .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
  59. .catch Ljava/lang/NoSuchMethodException; {:try_start_0 .. :try_end_0} :catch_0
  60. const-string v1, "org.eclipse.jetty.alpn.ALPN"
  61. :try_start_1
  62. invoke-static {v1}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
  63. move-result-object v1
  64. new-instance v2, Ljava/lang/StringBuilder;
  65. invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
  66. invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  67. const-string v3, "$Provider"
  68. invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  69. invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  70. move-result-object v2
  71. invoke-static {v2}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
  72. move-result-object v2
  73. new-instance v3, Ljava/lang/StringBuilder;
  74. invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
  75. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  76. const-string v4, "$ClientProvider"
  77. invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  78. invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  79. move-result-object v3
  80. invoke-static {v3}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
  81. move-result-object v8
  82. new-instance v3, Ljava/lang/StringBuilder;
  83. invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
  84. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  85. const-string v0, "$ServerProvider"
  86. invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  87. invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  88. move-result-object v0
  89. invoke-static {v0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
  90. move-result-object v9
  91. const-string v0, "put"
  92. const/4 v3, 0x2
  93. new-array v3, v3, [Ljava/lang/Class;
  94. const-class v4, Ljavax/net/ssl/SSLSocket;
  95. const/4 v5, 0x0
  96. aput-object v4, v3, v5
  97. const/4 v4, 0x1
  98. aput-object v2, v3, v4
  99. invoke-virtual {v1, v0, v3}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  100. move-result-object v0
  101. const-string v2, "get"
  102. new-array v3, v4, [Ljava/lang/Class;
  103. const-class v6, Ljavax/net/ssl/SSLSocket;
  104. aput-object v6, v3, v5
  105. invoke-virtual {v1, v2, v3}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  106. move-result-object v6
  107. const-string v2, "remove"
  108. new-array v3, v4, [Ljava/lang/Class;
  109. const-class v4, Ljavax/net/ssl/SSLSocket;
  110. aput-object v4, v3, v5
  111. invoke-virtual {v1, v2, v3}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
  112. move-result-object v7
  113. new-instance v1, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;
  114. move-object v4, v1
  115. move-object v5, v0
  116. invoke-direct/range {v4 .. v9}, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;-><init>(Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;Ljava/lang/Class;Ljava/lang/Class;)V
  117. :try_end_1
  118. .catch Ljava/lang/ClassNotFoundException; {:try_start_1 .. :try_end_1} :catch_0
  119. .catch Ljava/lang/NoSuchMethodException; {:try_start_1 .. :try_end_1} :catch_0
  120. return-object v1
  121. :catch_0
  122. const/4 v0, 0x0
  123. return-object v0
  124. .end method
  125. # virtual methods
  126. .method public afterHandshake(Ljavax/net/ssl/SSLSocket;)V
  127. .locals 4
  128. :try_start_0
  129. iget-object v0, p0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;->removeMethod:Ljava/lang/reflect/Method;
  130. const/4 v1, 0x0
  131. const/4 v2, 0x1
  132. new-array v2, v2, [Ljava/lang/Object;
  133. const/4 v3, 0x0
  134. aput-object p1, v2, v3
  135. invoke-virtual {v0, v1, v2}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  136. :try_end_0
  137. .catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_1
  138. .catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_0
  139. return-void
  140. :catch_0
  141. move-exception p1
  142. goto :goto_0
  143. :catch_1
  144. move-exception p1
  145. :goto_0
  146. const-string v0, "unable to remove alpn"
  147. invoke-static {v0, p1}, Lokhttp3/internal/Util;->assertionError(Ljava/lang/String;Ljava/lang/Exception;)Ljava/lang/AssertionError;
  148. move-result-object p1
  149. throw p1
  150. .end method
  151. .method public configureTlsExtensions(Ljavax/net/ssl/SSLSocket;Ljava/lang/String;Ljava/util/List;)V
  152. .locals 5
  153. .annotation system Ldalvik/annotation/Signature;
  154. value = {
  155. "(",
  156. "Ljavax/net/ssl/SSLSocket;",
  157. "Ljava/lang/String;",
  158. "Ljava/util/List<",
  159. "Lokhttp3/Protocol;",
  160. ">;)V"
  161. }
  162. .end annotation
  163. invoke-static {p3}, Lokhttp3/internal/platform/Platform;->alpnProtocolNames(Ljava/util/List;)Ljava/util/List;
  164. move-result-object p2
  165. :try_start_0
  166. const-class p3, Lokhttp3/internal/platform/Platform;
  167. invoke-virtual {p3}, Ljava/lang/Class;->getClassLoader()Ljava/lang/ClassLoader;
  168. move-result-object p3
  169. const/4 v0, 0x2
  170. new-array v1, v0, [Ljava/lang/Class;
  171. iget-object v2, p0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;->clientProviderClass:Ljava/lang/Class;
  172. const/4 v3, 0x0
  173. aput-object v2, v1, v3
  174. iget-object v2, p0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;->serverProviderClass:Ljava/lang/Class;
  175. const/4 v4, 0x1
  176. aput-object v2, v1, v4
  177. new-instance v2, Lokhttp3/internal/platform/JdkWithJettyBootPlatform$JettyNegoProvider;
  178. invoke-direct {v2, p2}, Lokhttp3/internal/platform/JdkWithJettyBootPlatform$JettyNegoProvider;-><init>(Ljava/util/List;)V
  179. invoke-static {p3, v1, v2}, Ljava/lang/reflect/Proxy;->newProxyInstance(Ljava/lang/ClassLoader;[Ljava/lang/Class;Ljava/lang/reflect/InvocationHandler;)Ljava/lang/Object;
  180. move-result-object p2
  181. iget-object p3, p0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;->putMethod:Ljava/lang/reflect/Method;
  182. const/4 v1, 0x0
  183. new-array v0, v0, [Ljava/lang/Object;
  184. aput-object p1, v0, v3
  185. aput-object p2, v0, v4
  186. invoke-virtual {p3, v1, v0}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  187. :try_end_0
  188. .catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_1
  189. .catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_0
  190. return-void
  191. :catch_0
  192. move-exception p1
  193. goto :goto_0
  194. :catch_1
  195. move-exception p1
  196. :goto_0
  197. const-string p2, "unable to set alpn"
  198. invoke-static {p2, p1}, Lokhttp3/internal/Util;->assertionError(Ljava/lang/String;Ljava/lang/Exception;)Ljava/lang/AssertionError;
  199. move-result-object p1
  200. throw p1
  201. .end method
  202. .method public getSelectedProtocol(Ljavax/net/ssl/SSLSocket;)Ljava/lang/String;
  203. .locals 3
  204. :try_start_0
  205. iget-object v0, p0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform;->getMethod:Ljava/lang/reflect/Method;
  206. const/4 v1, 0x1
  207. new-array v1, v1, [Ljava/lang/Object;
  208. const/4 v2, 0x0
  209. aput-object p1, v1, v2
  210. const/4 p1, 0x0
  211. invoke-virtual {v0, p1, v1}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
  212. move-result-object v0
  213. invoke-static {v0}, Ljava/lang/reflect/Proxy;->getInvocationHandler(Ljava/lang/Object;)Ljava/lang/reflect/InvocationHandler;
  214. move-result-object v0
  215. check-cast v0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform$JettyNegoProvider;
  216. iget-boolean v1, v0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform$JettyNegoProvider;->unsupported:Z
  217. if-nez v1, :cond_0
  218. iget-object v1, v0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform$JettyNegoProvider;->selected:Ljava/lang/String;
  219. if-nez v1, :cond_0
  220. invoke-static {}, Lokhttp3/internal/platform/Platform;->get()Lokhttp3/internal/platform/Platform;
  221. move-result-object v0
  222. const/4 v1, 0x4
  223. const-string v2, "ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path?"
  224. invoke-virtual {v0, v1, v2, p1}, Lokhttp3/internal/platform/Platform;->log(ILjava/lang/String;Ljava/lang/Throwable;)V
  225. return-object p1
  226. :cond_0
  227. iget-boolean v1, v0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform$JettyNegoProvider;->unsupported:Z
  228. if-eqz v1, :cond_1
  229. goto :goto_0
  230. :cond_1
  231. iget-object p1, v0, Lokhttp3/internal/platform/JdkWithJettyBootPlatform$JettyNegoProvider;->selected:Ljava/lang/String;
  232. :try_end_0
  233. .catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_1
  234. .catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_0
  235. :goto_0
  236. return-object p1
  237. :catch_0
  238. move-exception p1
  239. goto :goto_1
  240. :catch_1
  241. move-exception p1
  242. :goto_1
  243. const-string v0, "unable to get selected protocol"
  244. invoke-static {v0, p1}, Lokhttp3/internal/Util;->assertionError(Ljava/lang/String;Ljava/lang/Exception;)Ljava/lang/AssertionError;
  245. move-result-object p1
  246. throw p1
  247. .end method