MockWebServer$2.smali 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. .class Lokhttp3/mockwebserver/MockWebServer$2;
  2. .super Lokhttp3/internal/NamedRunnable;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/EnclosingMethod;
  6. value = Lokhttp3/mockwebserver/MockWebServer;->start(Ljava/net/InetSocketAddress;)V
  7. .end annotation
  8. .annotation system Ldalvik/annotation/InnerClass;
  9. accessFlags = 0x0
  10. name = null
  11. .end annotation
  12. # instance fields
  13. .field final synthetic this$0:Lokhttp3/mockwebserver/MockWebServer;
  14. # direct methods
  15. .method varargs constructor <init>(Lokhttp3/mockwebserver/MockWebServer;Ljava/lang/String;[Ljava/lang/Object;)V
  16. .locals 0
  17. iput-object p1, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  18. invoke-direct {p0, p2, p3}, Lokhttp3/internal/NamedRunnable;-><init>(Ljava/lang/String;[Ljava/lang/Object;)V
  19. return-void
  20. .end method
  21. .method private acceptConnections()V
  22. .locals 4
  23. .annotation system Ldalvik/annotation/Throws;
  24. value = {
  25. Ljava/lang/Exception;
  26. }
  27. .end annotation
  28. :goto_0
  29. :try_start_0
  30. iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  31. invoke-static {v0}, Lokhttp3/mockwebserver/MockWebServer;->access$100(Lokhttp3/mockwebserver/MockWebServer;)Ljava/net/ServerSocket;
  32. move-result-object v0
  33. invoke-virtual {v0}, Ljava/net/ServerSocket;->accept()Ljava/net/Socket;
  34. move-result-object v0
  35. :try_end_0
  36. .catch Ljava/net/SocketException; {:try_start_0 .. :try_end_0} :catch_0
  37. iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  38. invoke-static {v1}, Lokhttp3/mockwebserver/MockWebServer;->access$400(Lokhttp3/mockwebserver/MockWebServer;)Lokhttp3/mockwebserver/Dispatcher;
  39. move-result-object v1
  40. invoke-virtual {v1}, Lokhttp3/mockwebserver/Dispatcher;->peek()Lokhttp3/mockwebserver/MockResponse;
  41. move-result-object v1
  42. invoke-virtual {v1}, Lokhttp3/mockwebserver/MockResponse;->getSocketPolicy()Lokhttp3/mockwebserver/SocketPolicy;
  43. move-result-object v1
  44. sget-object v2, Lokhttp3/mockwebserver/SocketPolicy;->DISCONNECT_AT_START:Lokhttp3/mockwebserver/SocketPolicy;
  45. if-ne v1, v2, :cond_0
  46. iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  47. const/4 v2, 0x0
  48. invoke-static {v1, v2, v0}, Lokhttp3/mockwebserver/MockWebServer;->access$600(Lokhttp3/mockwebserver/MockWebServer;ILjava/net/Socket;)V
  49. invoke-virtual {v0}, Ljava/net/Socket;->close()V
  50. goto :goto_0
  51. :cond_0
  52. iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  53. invoke-static {v1}, Lokhttp3/mockwebserver/MockWebServer;->access$200(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/Set;
  54. move-result-object v1
  55. invoke-interface {v1, v0}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
  56. iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  57. invoke-static {v1, v0}, Lokhttp3/mockwebserver/MockWebServer;->access$700(Lokhttp3/mockwebserver/MockWebServer;Ljava/net/Socket;)V
  58. goto :goto_0
  59. :catch_0
  60. move-exception v0
  61. invoke-static {}, Lokhttp3/mockwebserver/MockWebServer;->access$000()Ljava/util/logging/Logger;
  62. move-result-object v1
  63. new-instance v2, Ljava/lang/StringBuilder;
  64. invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
  65. iget-object v3, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  66. invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  67. const-string v3, " done accepting connections: "
  68. invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  69. invoke-virtual {v0}, Ljava/net/SocketException;->getMessage()Ljava/lang/String;
  70. move-result-object v0
  71. invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  72. invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  73. move-result-object v0
  74. invoke-virtual {v1, v0}, Ljava/util/logging/Logger;->info(Ljava/lang/String;)V
  75. return-void
  76. .end method
  77. # virtual methods
  78. .method protected execute()V
  79. .locals 5
  80. :try_start_0
  81. invoke-static {}, Lokhttp3/mockwebserver/MockWebServer;->access$000()Ljava/util/logging/Logger;
  82. move-result-object v0
  83. new-instance v1, Ljava/lang/StringBuilder;
  84. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  85. iget-object v2, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  86. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  87. const-string v2, " starting to accept connections"
  88. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  89. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  90. move-result-object v1
  91. invoke-virtual {v0, v1}, Ljava/util/logging/Logger;->info(Ljava/lang/String;)V
  92. invoke-direct {p0}, Lokhttp3/mockwebserver/MockWebServer$2;->acceptConnections()V
  93. :try_end_0
  94. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  95. goto :goto_0
  96. :catchall_0
  97. move-exception v0
  98. invoke-static {}, Lokhttp3/mockwebserver/MockWebServer;->access$000()Ljava/util/logging/Logger;
  99. move-result-object v1
  100. sget-object v2, Ljava/util/logging/Level;->WARNING:Ljava/util/logging/Level;
  101. new-instance v3, Ljava/lang/StringBuilder;
  102. invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
  103. iget-object v4, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  104. invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  105. const-string v4, " failed unexpectedly"
  106. invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  107. invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  108. move-result-object v3
  109. invoke-virtual {v1, v2, v3, v0}, Ljava/util/logging/Logger;->log(Ljava/util/logging/Level;Ljava/lang/String;Ljava/lang/Throwable;)V
  110. :goto_0
  111. iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  112. invoke-static {v0}, Lokhttp3/mockwebserver/MockWebServer;->access$100(Lokhttp3/mockwebserver/MockWebServer;)Ljava/net/ServerSocket;
  113. move-result-object v0
  114. invoke-static {v0}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/ServerSocket;)V
  115. iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  116. invoke-static {v0}, Lokhttp3/mockwebserver/MockWebServer;->access$200(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/Set;
  117. move-result-object v0
  118. invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
  119. move-result-object v0
  120. :goto_1
  121. invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
  122. move-result v1
  123. if-eqz v1, :cond_0
  124. invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
  125. move-result-object v1
  126. check-cast v1, Ljava/net/Socket;
  127. invoke-static {v1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
  128. invoke-interface {v0}, Ljava/util/Iterator;->remove()V
  129. goto :goto_1
  130. :cond_0
  131. iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  132. invoke-static {v0}, Lokhttp3/mockwebserver/MockWebServer;->access$300(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/Set;
  133. move-result-object v0
  134. invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
  135. move-result-object v0
  136. :goto_2
  137. invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
  138. move-result v1
  139. if-eqz v1, :cond_1
  140. invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
  141. move-result-object v1
  142. check-cast v1, Ljava/io/Closeable;
  143. invoke-static {v1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
  144. invoke-interface {v0}, Ljava/util/Iterator;->remove()V
  145. goto :goto_2
  146. :cond_1
  147. iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  148. invoke-static {v0}, Lokhttp3/mockwebserver/MockWebServer;->access$400(Lokhttp3/mockwebserver/MockWebServer;)Lokhttp3/mockwebserver/Dispatcher;
  149. move-result-object v0
  150. invoke-virtual {v0}, Lokhttp3/mockwebserver/Dispatcher;->shutdown()V
  151. iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$2;->this$0:Lokhttp3/mockwebserver/MockWebServer;
  152. invoke-static {v0}, Lokhttp3/mockwebserver/MockWebServer;->access$500(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/concurrent/ExecutorService;
  153. move-result-object v0
  154. invoke-interface {v0}, Ljava/util/concurrent/ExecutorService;->shutdown()V
  155. return-void
  156. .end method