123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979 |
- .class Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;
- .super Lokhttp3/internal/http2/Http2Connection$Listener;
- .source ""
- # annotations
- .annotation system Ldalvik/annotation/EnclosingClass;
- value = Lokhttp3/mockwebserver/MockWebServer;
- .end annotation
- .annotation system Ldalvik/annotation/InnerClass;
- accessFlags = 0x2
- name = "Http2SocketHandler"
- .end annotation
- # instance fields
- .field private final protocol:Lokhttp3/Protocol;
- .field private final sequenceNumber:Ljava/util/concurrent/atomic/AtomicInteger;
- .field private final socket:Ljava/net/Socket;
- .field final synthetic this$0:Lokhttp3/mockwebserver/MockWebServer;
- # direct methods
- .method private constructor <init>(Lokhttp3/mockwebserver/MockWebServer;Ljava/net/Socket;Lokhttp3/Protocol;)V
- .locals 0
- iput-object p1, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- invoke-direct {p0}, Lokhttp3/internal/http2/Http2Connection$Listener;-><init>()V
- new-instance p1, Ljava/util/concurrent/atomic/AtomicInteger;
- invoke-direct {p1}, Ljava/util/concurrent/atomic/AtomicInteger;-><init>()V
- iput-object p1, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->sequenceNumber:Ljava/util/concurrent/atomic/AtomicInteger;
- iput-object p2, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->socket:Ljava/net/Socket;
- iput-object p3, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->protocol:Lokhttp3/Protocol;
- return-void
- .end method
- .method synthetic constructor <init>(Lokhttp3/mockwebserver/MockWebServer;Ljava/net/Socket;Lokhttp3/Protocol;Lokhttp3/mockwebserver/MockWebServer$1;)V
- .locals 0
- invoke-direct {p0, p1, p2, p3}, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;-><init>(Lokhttp3/mockwebserver/MockWebServer;Ljava/net/Socket;Lokhttp3/Protocol;)V
- return-void
- .end method
- .method private pushPromises(Lokhttp3/internal/http2/Http2Stream;Ljava/util/List;)V
- .locals 16
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "(",
- "Lokhttp3/internal/http2/Http2Stream;",
- "Ljava/util/List<",
- "Lokhttp3/mockwebserver/PushPromise;",
- ">;)V"
- }
- .end annotation
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- move-object/from16 v0, p0
- invoke-interface/range {p2 .. p2}, Ljava/util/List;->iterator()Ljava/util/Iterator;
- move-result-object v1
- :goto_0
- invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
- move-result v2
- if-eqz v2, :cond_2
- invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
- move-result-object v2
- check-cast v2, Lokhttp3/mockwebserver/PushPromise;
- new-instance v3, Ljava/util/ArrayList;
- invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V
- new-instance v4, Lokhttp3/internal/http2/Header;
- sget-object v5, Lokhttp3/internal/http2/Header;->TARGET_AUTHORITY:Lokio/ByteString;
- iget-object v6, v0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- invoke-virtual {v2}, Lokhttp3/mockwebserver/PushPromise;->path()Ljava/lang/String;
- move-result-object v7
- invoke-virtual {v6, v7}, Lokhttp3/mockwebserver/MockWebServer;->url(Ljava/lang/String;)Lokhttp3/HttpUrl;
- move-result-object v6
- invoke-virtual {v6}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
- move-result-object v6
- invoke-direct {v4, v5, v6}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V
- invoke-interface {v3, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
- new-instance v4, Lokhttp3/internal/http2/Header;
- sget-object v5, Lokhttp3/internal/http2/Header;->TARGET_METHOD:Lokio/ByteString;
- invoke-virtual {v2}, Lokhttp3/mockwebserver/PushPromise;->method()Ljava/lang/String;
- move-result-object v6
- invoke-direct {v4, v5, v6}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V
- invoke-interface {v3, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
- new-instance v4, Lokhttp3/internal/http2/Header;
- sget-object v5, Lokhttp3/internal/http2/Header;->TARGET_PATH:Lokio/ByteString;
- invoke-virtual {v2}, Lokhttp3/mockwebserver/PushPromise;->path()Ljava/lang/String;
- move-result-object v6
- invoke-direct {v4, v5, v6}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V
- invoke-interface {v3, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
- invoke-virtual {v2}, Lokhttp3/mockwebserver/PushPromise;->headers()Lokhttp3/Headers;
- move-result-object v4
- invoke-virtual {v4}, Lokhttp3/Headers;->size()I
- move-result v5
- const/4 v6, 0x0
- const/4 v7, 0x0
- :goto_1
- if-ge v7, v5, :cond_0
- new-instance v8, Lokhttp3/internal/http2/Header;
- invoke-virtual {v4, v7}, Lokhttp3/Headers;->name(I)Ljava/lang/String;
- move-result-object v9
- invoke-virtual {v4, v7}, Lokhttp3/Headers;->value(I)Ljava/lang/String;
- move-result-object v10
- invoke-direct {v8, v9, v10}, Lokhttp3/internal/http2/Header;-><init>(Ljava/lang/String;Ljava/lang/String;)V
- invoke-interface {v3, v8}, Ljava/util/List;->add(Ljava/lang/Object;)Z
- add-int/lit8 v7, v7, 0x1
- goto :goto_1
- :cond_0
- new-instance v4, Ljava/lang/StringBuilder;
- invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v2}, Lokhttp3/mockwebserver/PushPromise;->method()Ljava/lang/String;
- move-result-object v5
- invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- const/16 v5, 0x20
- invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
- invoke-virtual {v2}, Lokhttp3/mockwebserver/PushPromise;->path()Ljava/lang/String;
- move-result-object v5
- invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- const-string v5, " HTTP/1.1"
- invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v8
- invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
- move-result-object v10
- iget-object v4, v0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- invoke-static {v4}, Lokhttp3/mockwebserver/MockWebServer;->access$1600(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/concurrent/BlockingQueue;
- move-result-object v4
- new-instance v5, Lokhttp3/mockwebserver/RecordedRequest;
- invoke-virtual {v2}, Lokhttp3/mockwebserver/PushPromise;->headers()Lokhttp3/Headers;
- move-result-object v9
- const-wide/16 v11, 0x0
- new-instance v13, Lokio/Buffer;
- invoke-direct {v13}, Lokio/Buffer;-><init>()V
- iget-object v7, v0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->sequenceNumber:Ljava/util/concurrent/atomic/AtomicInteger;
- invoke-virtual {v7}, Ljava/util/concurrent/atomic/AtomicInteger;->getAndIncrement()I
- move-result v14
- iget-object v15, v0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->socket:Ljava/net/Socket;
- move-object v7, v5
- invoke-direct/range {v7 .. v15}, Lokhttp3/mockwebserver/RecordedRequest;-><init>(Ljava/lang/String;Lokhttp3/Headers;Ljava/util/List;JLokio/Buffer;ILjava/net/Socket;)V
- invoke-interface {v4, v5}, Ljava/util/concurrent/BlockingQueue;->add(Ljava/lang/Object;)Z
- invoke-virtual {v2}, Lokhttp3/mockwebserver/PushPromise;->response()Lokhttp3/mockwebserver/MockResponse;
- move-result-object v4
- invoke-virtual {v4}, Lokhttp3/mockwebserver/MockResponse;->getBody()Lokio/Buffer;
- move-result-object v4
- if-eqz v4, :cond_1
- const/4 v6, 0x1
- :cond_1
- invoke-virtual/range {p1 .. p1}, Lokhttp3/internal/http2/Http2Stream;->getConnection()Lokhttp3/internal/http2/Http2Connection;
- move-result-object v4
- invoke-virtual/range {p1 .. p1}, Lokhttp3/internal/http2/Http2Stream;->getId()I
- move-result v5
- invoke-virtual {v4, v5, v3, v6}, Lokhttp3/internal/http2/Http2Connection;->pushStream(ILjava/util/List;Z)Lokhttp3/internal/http2/Http2Stream;
- move-result-object v3
- invoke-virtual {v2}, Lokhttp3/mockwebserver/PushPromise;->response()Lokhttp3/mockwebserver/MockResponse;
- move-result-object v2
- invoke-direct {v0, v3, v2}, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->writeResponse(Lokhttp3/internal/http2/Http2Stream;Lokhttp3/mockwebserver/MockResponse;)V
- goto/16 :goto_0
- :cond_2
- return-void
- .end method
- .method private readRequest(Lokhttp3/internal/http2/Http2Stream;)Lokhttp3/mockwebserver/RecordedRequest;
- .locals 18
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- move-object/from16 v0, p0
- invoke-virtual/range {p1 .. p1}, Lokhttp3/internal/http2/Http2Stream;->getRequestHeaders()Ljava/util/List;
- move-result-object v1
- new-instance v2, Lokhttp3/Headers$Builder;
- invoke-direct {v2}, Lokhttp3/Headers$Builder;-><init>()V
- invoke-interface {v1}, Ljava/util/List;->size()I
- move-result v3
- const/4 v4, 0x0
- const/4 v5, 0x1
- const-string v6, "<:method omitted>"
- const-string v7, "<:path omitted>"
- move-object v8, v6
- move-object v9, v7
- const/4 v6, 0x0
- const/4 v7, 0x1
- :goto_0
- if-ge v6, v3, :cond_4
- invoke-interface {v1, v6}, Ljava/util/List;->get(I)Ljava/lang/Object;
- move-result-object v10
- check-cast v10, Lokhttp3/internal/http2/Header;
- iget-object v10, v10, Lokhttp3/internal/http2/Header;->name:Lokio/ByteString;
- invoke-interface {v1, v6}, Ljava/util/List;->get(I)Ljava/lang/Object;
- move-result-object v11
- check-cast v11, Lokhttp3/internal/http2/Header;
- iget-object v11, v11, Lokhttp3/internal/http2/Header;->value:Lokio/ByteString;
- invoke-virtual {v11}, Lokio/ByteString;->utf8()Ljava/lang/String;
- move-result-object v11
- sget-object v12, Lokhttp3/internal/http2/Header;->TARGET_METHOD:Lokio/ByteString;
- invoke-virtual {v10, v12}, Lokio/ByteString;->equals(Ljava/lang/Object;)Z
- move-result v12
- if-eqz v12, :cond_0
- move-object v8, v11
- goto :goto_1
- :cond_0
- sget-object v12, Lokhttp3/internal/http2/Header;->TARGET_PATH:Lokio/ByteString;
- invoke-virtual {v10, v12}, Lokio/ByteString;->equals(Ljava/lang/Object;)Z
- move-result v12
- if-eqz v12, :cond_1
- move-object v9, v11
- goto :goto_1
- :cond_1
- iget-object v12, v0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->protocol:Lokhttp3/Protocol;
- sget-object v13, Lokhttp3/Protocol;->HTTP_2:Lokhttp3/Protocol;
- if-ne v12, v13, :cond_3
- invoke-virtual {v10}, Lokio/ByteString;->utf8()Ljava/lang/String;
- move-result-object v12
- invoke-virtual {v2, v12, v11}, Lokhttp3/Headers$Builder;->add(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$Builder;
- :goto_1
- invoke-virtual {v10}, Lokio/ByteString;->utf8()Ljava/lang/String;
- move-result-object v10
- const-string v12, "expect"
- invoke-virtual {v10, v12}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
- move-result v10
- if-eqz v10, :cond_2
- const-string v10, "100-continue"
- invoke-virtual {v11, v10}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v10
- if-eqz v10, :cond_2
- const/4 v7, 0x0
- :cond_2
- add-int/lit8 v6, v6, 0x1
- goto :goto_0
- :cond_3
- new-instance v1, Ljava/lang/IllegalStateException;
- invoke-direct {v1}, Ljava/lang/IllegalStateException;-><init>()V
- throw v1
- :cond_4
- invoke-virtual {v2}, Lokhttp3/Headers$Builder;->build()Lokhttp3/Headers;
- move-result-object v4
- iget-object v1, v0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- invoke-static {v1}, Lokhttp3/mockwebserver/MockWebServer;->access$400(Lokhttp3/mockwebserver/MockWebServer;)Lokhttp3/mockwebserver/Dispatcher;
- move-result-object v1
- invoke-virtual {v1}, Lokhttp3/mockwebserver/Dispatcher;->peek()Lokhttp3/mockwebserver/MockResponse;
- move-result-object v11
- if-nez v7, :cond_5
- invoke-virtual {v11}, Lokhttp3/mockwebserver/MockResponse;->getSocketPolicy()Lokhttp3/mockwebserver/SocketPolicy;
- move-result-object v1
- sget-object v2, Lokhttp3/mockwebserver/SocketPolicy;->EXPECT_CONTINUE:Lokhttp3/mockwebserver/SocketPolicy;
- if-ne v1, v2, :cond_5
- new-instance v1, Lokhttp3/internal/http2/Header;
- sget-object v2, Lokhttp3/internal/http2/Header;->RESPONSE_STATUS:Lokio/ByteString;
- const-string v3, "100 Continue"
- invoke-static {v3}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
- move-result-object v3
- invoke-direct {v1, v2, v3}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Lokio/ByteString;)V
- invoke-static {v1}, Ljava/util/Collections;->singletonList(Ljava/lang/Object;)Ljava/util/List;
- move-result-object v1
- move-object/from16 v2, p1
- invoke-virtual {v2, v1, v5}, Lokhttp3/internal/http2/Http2Stream;->sendResponseHeaders(Ljava/util/List;Z)V
- invoke-virtual/range {p1 .. p1}, Lokhttp3/internal/http2/Http2Stream;->getConnection()Lokhttp3/internal/http2/Http2Connection;
- move-result-object v1
- invoke-virtual {v1}, Lokhttp3/internal/http2/Http2Connection;->flush()V
- goto :goto_2
- :cond_5
- move-object/from16 v2, p1
- move v5, v7
- :goto_2
- new-instance v1, Lokio/Buffer;
- invoke-direct {v1}, Lokio/Buffer;-><init>()V
- if-eqz v5, :cond_7
- const-string v3, "content-length"
- invoke-virtual {v4, v3}, Lokhttp3/Headers;->get(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v3
- if-eqz v3, :cond_6
- invoke-static {v3}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J
- move-result-wide v5
- goto :goto_3
- :cond_6
- const-wide v5, 0x7fffffffffffffffL
- :goto_3
- move-wide v15, v5
- iget-object v10, v0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- iget-object v12, v0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->socket:Ljava/net/Socket;
- invoke-virtual/range {p1 .. p1}, Lokhttp3/internal/http2/Http2Stream;->getSource()Lokio/Source;
- move-result-object v2
- invoke-static {v2}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
- move-result-object v13
- const/16 v17, 0x1
- move-object v14, v1
- invoke-static/range {v10 .. v17}, Lokhttp3/mockwebserver/MockWebServer;->access$2100(Lokhttp3/mockwebserver/MockWebServer;Lokhttp3/mockwebserver/MockResponse;Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;JZ)V
- :cond_7
- new-instance v2, Ljava/lang/StringBuilder;
- invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v2, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- const/16 v3, 0x20
- invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
- invoke-virtual {v2, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- const-string v3, " HTTP/1.1"
- invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v3
- invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
- move-result-object v5
- new-instance v11, Lokhttp3/mockwebserver/RecordedRequest;
- invoke-virtual {v1}, Lokio/Buffer;->size()J
- move-result-wide v6
- iget-object v2, v0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->sequenceNumber:Ljava/util/concurrent/atomic/AtomicInteger;
- invoke-virtual {v2}, Ljava/util/concurrent/atomic/AtomicInteger;->getAndIncrement()I
- move-result v9
- iget-object v10, v0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->socket:Ljava/net/Socket;
- move-object v2, v11
- move-object v8, v1
- invoke-direct/range {v2 .. v10}, Lokhttp3/mockwebserver/RecordedRequest;-><init>(Ljava/lang/String;Lokhttp3/Headers;Ljava/util/List;JLokio/Buffer;ILjava/net/Socket;)V
- return-object v11
- .end method
- .method private writeResponse(Lokhttp3/internal/http2/Http2Stream;Lokhttp3/mockwebserver/MockResponse;)V
- .locals 11
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- invoke-virtual {p2}, Lokhttp3/mockwebserver/MockResponse;->getSettings()Lokhttp3/internal/http2/Settings;
- move-result-object v2
- if-eqz v2, :cond_0
- invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Stream;->getConnection()Lokhttp3/internal/http2/Http2Connection;
- move-result-object v3
- invoke-virtual {v3, v2}, Lokhttp3/internal/http2/Http2Connection;->setSettings(Lokhttp3/internal/http2/Settings;)V
- :cond_0
- invoke-virtual {p2}, Lokhttp3/mockwebserver/MockResponse;->getSocketPolicy()Lokhttp3/mockwebserver/SocketPolicy;
- move-result-object v2
- sget-object v3, Lokhttp3/mockwebserver/SocketPolicy;->NO_RESPONSE:Lokhttp3/mockwebserver/SocketPolicy;
- if-ne v2, v3, :cond_1
- return-void
- :cond_1
- new-instance v2, Ljava/util/ArrayList;
- invoke-direct {v2}, Ljava/util/ArrayList;-><init>()V
- invoke-virtual {p2}, Lokhttp3/mockwebserver/MockResponse;->getStatus()Ljava/lang/String;
- move-result-object v3
- const/4 v4, 0x3
- const-string v5, " "
- invoke-virtual {v3, v5, v4}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String;
- move-result-object v3
- array-length v4, v3
- const/4 v5, 0x2
- if-lt v4, v5, :cond_7
- new-instance v4, Lokhttp3/internal/http2/Header;
- sget-object v5, Lokhttp3/internal/http2/Header;->RESPONSE_STATUS:Lokio/ByteString;
- const/4 v6, 0x1
- aget-object v3, v3, v6
- invoke-direct {v4, v5, v3}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V
- invoke-interface {v2, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
- invoke-virtual {p2}, Lokhttp3/mockwebserver/MockResponse;->getHeaders()Lokhttp3/Headers;
- move-result-object v3
- invoke-virtual {v3}, Lokhttp3/Headers;->size()I
- move-result v4
- const/4 v5, 0x0
- const/4 v7, 0x0
- :goto_0
- if-ge v7, v4, :cond_2
- new-instance v8, Lokhttp3/internal/http2/Header;
- invoke-virtual {v3, v7}, Lokhttp3/Headers;->name(I)Ljava/lang/String;
- move-result-object v9
- invoke-virtual {v3, v7}, Lokhttp3/Headers;->value(I)Ljava/lang/String;
- move-result-object v10
- invoke-direct {v8, v9, v10}, Lokhttp3/internal/http2/Header;-><init>(Ljava/lang/String;Ljava/lang/String;)V
- invoke-interface {v2, v8}, Ljava/util/List;->add(Ljava/lang/Object;)Z
- add-int/lit8 v7, v7, 0x1
- goto :goto_0
- :cond_2
- iget-object v3, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- sget-object v4, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
- invoke-virtual {p2, v4}, Lokhttp3/mockwebserver/MockResponse;->getHeadersDelay(Ljava/util/concurrent/TimeUnit;)J
- move-result-wide v7
- invoke-static {v3, v7, v8}, Lokhttp3/mockwebserver/MockWebServer;->access$2200(Lokhttp3/mockwebserver/MockWebServer;J)V
- invoke-virtual {p2}, Lokhttp3/mockwebserver/MockResponse;->getBody()Lokio/Buffer;
- move-result-object v3
- if-nez v3, :cond_3
- invoke-virtual {p2}, Lokhttp3/mockwebserver/MockResponse;->getPushPromises()Ljava/util/List;
- move-result-object v4
- invoke-interface {v4}, Ljava/util/List;->isEmpty()Z
- move-result v4
- if-nez v4, :cond_4
- :cond_3
- const/4 v5, 0x1
- :cond_4
- invoke-virtual {p1, v2, v5}, Lokhttp3/internal/http2/Http2Stream;->sendResponseHeaders(Ljava/util/List;Z)V
- invoke-virtual {p2}, Lokhttp3/mockwebserver/MockResponse;->getPushPromises()Ljava/util/List;
- move-result-object v2
- invoke-direct {p0, p1, v2}, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->pushPromises(Lokhttp3/internal/http2/Http2Stream;Ljava/util/List;)V
- if-eqz v3, :cond_5
- invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Stream;->getSink()Lokio/Sink;
- move-result-object v0
- invoke-static {v0}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink;
- move-result-object v8
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- sget-object v2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
- invoke-virtual {p2, v2}, Lokhttp3/mockwebserver/MockResponse;->getBodyDelay(Ljava/util/concurrent/TimeUnit;)J
- move-result-wide v4
- invoke-static {v0, v4, v5}, Lokhttp3/mockwebserver/MockWebServer;->access$2200(Lokhttp3/mockwebserver/MockWebServer;J)V
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- iget-object v2, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->socket:Ljava/net/Socket;
- invoke-virtual {v3}, Lokio/Buffer;->size()J
- move-result-wide v5
- const/4 v7, 0x0
- move-object v1, p2
- move-object v4, v8
- invoke-static/range {v0 .. v7}, Lokhttp3/mockwebserver/MockWebServer;->access$2100(Lokhttp3/mockwebserver/MockWebServer;Lokhttp3/mockwebserver/MockResponse;Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;JZ)V
- invoke-interface {v8}, Lokio/Sink;->close()V
- goto :goto_1
- :cond_5
- if-eqz v5, :cond_6
- sget-object v1, Lokhttp3/internal/http2/ErrorCode;->NO_ERROR:Lokhttp3/internal/http2/ErrorCode;
- invoke-virtual {p1, v1}, Lokhttp3/internal/http2/Http2Stream;->close(Lokhttp3/internal/http2/ErrorCode;)V
- :cond_6
- :goto_1
- return-void
- :cond_7
- new-instance v0, Ljava/lang/AssertionError;
- new-instance v2, Ljava/lang/StringBuilder;
- invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
- const-string v3, "Unexpected status: "
- invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {p2}, Lokhttp3/mockwebserver/MockResponse;->getStatus()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v1
- invoke-direct {v0, v1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
- goto :goto_3
- :goto_2
- throw v0
- :goto_3
- goto :goto_2
- .end method
- # virtual methods
- .method public onStream(Lokhttp3/internal/http2/Http2Stream;)V
- .locals 5
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- invoke-static {v0}, Lokhttp3/mockwebserver/MockWebServer;->access$400(Lokhttp3/mockwebserver/MockWebServer;)Lokhttp3/mockwebserver/Dispatcher;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/mockwebserver/Dispatcher;->peek()Lokhttp3/mockwebserver/MockResponse;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/mockwebserver/MockResponse;->getSocketPolicy()Lokhttp3/mockwebserver/SocketPolicy;
- move-result-object v1
- sget-object v2, Lokhttp3/mockwebserver/SocketPolicy;->RESET_STREAM_AT_START:Lokhttp3/mockwebserver/SocketPolicy;
- if-ne v1, v2, :cond_0
- :try_start_0
- iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- iget-object v2, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->sequenceNumber:Ljava/util/concurrent/atomic/AtomicInteger;
- invoke-virtual {v2}, Ljava/util/concurrent/atomic/AtomicInteger;->getAndIncrement()I
- move-result v2
- iget-object v3, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->socket:Ljava/net/Socket;
- invoke-static {v1, v2, v3}, Lokhttp3/mockwebserver/MockWebServer;->access$600(Lokhttp3/mockwebserver/MockWebServer;ILjava/net/Socket;)V
- invoke-virtual {v0}, Lokhttp3/mockwebserver/MockResponse;->getHttp2ErrorCode()I
- move-result v0
- invoke-static {v0}, Lokhttp3/internal/http2/ErrorCode;->fromHttp2(I)Lokhttp3/internal/http2/ErrorCode;
- move-result-object v0
- invoke-virtual {p1, v0}, Lokhttp3/internal/http2/Http2Stream;->close(Lokhttp3/internal/http2/ErrorCode;)V
- :try_end_0
- .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0
- return-void
- :catch_0
- new-instance p1, Ljava/io/InterruptedIOException;
- invoke-direct {p1}, Ljava/io/InterruptedIOException;-><init>()V
- throw p1
- :cond_0
- invoke-direct {p0, p1}, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->readRequest(Lokhttp3/internal/http2/Http2Stream;)Lokhttp3/mockwebserver/RecordedRequest;
- move-result-object v0
- iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- invoke-static {v1}, Lokhttp3/mockwebserver/MockWebServer;->access$1500(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/concurrent/atomic/AtomicInteger;
- move-result-object v1
- invoke-virtual {v1}, Ljava/util/concurrent/atomic/AtomicInteger;->incrementAndGet()I
- iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- invoke-static {v1}, Lokhttp3/mockwebserver/MockWebServer;->access$1600(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/concurrent/BlockingQueue;
- move-result-object v1
- invoke-interface {v1, v0}, Ljava/util/concurrent/BlockingQueue;->add(Ljava/lang/Object;)Z
- :try_start_1
- iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- invoke-static {v1}, Lokhttp3/mockwebserver/MockWebServer;->access$400(Lokhttp3/mockwebserver/MockWebServer;)Lokhttp3/mockwebserver/Dispatcher;
- move-result-object v1
- invoke-virtual {v1, v0}, Lokhttp3/mockwebserver/Dispatcher;->dispatch(Lokhttp3/mockwebserver/RecordedRequest;)Lokhttp3/mockwebserver/MockResponse;
- move-result-object v1
- :try_end_1
- .catch Ljava/lang/InterruptedException; {:try_start_1 .. :try_end_1} :catch_1
- invoke-virtual {v1}, Lokhttp3/mockwebserver/MockResponse;->getSocketPolicy()Lokhttp3/mockwebserver/SocketPolicy;
- move-result-object v2
- sget-object v3, Lokhttp3/mockwebserver/SocketPolicy;->DISCONNECT_AFTER_REQUEST:Lokhttp3/mockwebserver/SocketPolicy;
- if-ne v2, v3, :cond_1
- iget-object p1, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->socket:Ljava/net/Socket;
- invoke-virtual {p1}, Ljava/net/Socket;->close()V
- return-void
- :cond_1
- invoke-direct {p0, p1, v1}, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->writeResponse(Lokhttp3/internal/http2/Http2Stream;Lokhttp3/mockwebserver/MockResponse;)V
- invoke-static {}, Lokhttp3/mockwebserver/MockWebServer;->access$000()Ljava/util/logging/Logger;
- move-result-object v2
- sget-object v3, Ljava/util/logging/Level;->INFO:Ljava/util/logging/Level;
- invoke-virtual {v2, v3}, Ljava/util/logging/Logger;->isLoggable(Ljava/util/logging/Level;)Z
- move-result v2
- if-eqz v2, :cond_2
- invoke-static {}, Lokhttp3/mockwebserver/MockWebServer;->access$000()Ljava/util/logging/Logger;
- move-result-object v2
- new-instance v3, Ljava/lang/StringBuilder;
- invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
- iget-object v4, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->this$0:Lokhttp3/mockwebserver/MockWebServer;
- invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
- const-string v4, " received request: "
- invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
- const-string v0, " and responded: "
- invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
- const-string v0, " protocol is "
- invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;->protocol:Lokhttp3/Protocol;
- invoke-virtual {v0}, Lokhttp3/Protocol;->toString()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v2, v0}, Ljava/util/logging/Logger;->info(Ljava/lang/String;)V
- :cond_2
- invoke-virtual {v1}, Lokhttp3/mockwebserver/MockResponse;->getSocketPolicy()Lokhttp3/mockwebserver/SocketPolicy;
- move-result-object v0
- sget-object v1, Lokhttp3/mockwebserver/SocketPolicy;->DISCONNECT_AT_END:Lokhttp3/mockwebserver/SocketPolicy;
- if-ne v0, v1, :cond_3
- invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Stream;->getConnection()Lokhttp3/internal/http2/Http2Connection;
- move-result-object p1
- sget-object v0, Lokhttp3/internal/http2/ErrorCode;->NO_ERROR:Lokhttp3/internal/http2/ErrorCode;
- invoke-virtual {p1, v0}, Lokhttp3/internal/http2/Http2Connection;->shutdown(Lokhttp3/internal/http2/ErrorCode;)V
- :cond_3
- return-void
- :catch_1
- move-exception p1
- new-instance v0, Ljava/lang/AssertionError;
- invoke-direct {v0, p1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
- throw v0
- .end method
|