123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226 |
- .class public final Lokhttp3/mockwebserver/MockWebServer;
- .super Lorg/junit/rules/ExternalResource;
- .source ""
- # interfaces
- .implements Ljava/io/Closeable;
- # annotations
- .annotation system Ldalvik/annotation/MemberClasses;
- value = {
- Lokhttp3/mockwebserver/MockWebServer$Http2SocketHandler;,
- Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;
- }
- .end annotation
- # static fields
- .field private static final UNTRUSTED_TRUST_MANAGER:Ljavax/net/ssl/X509TrustManager;
- .field private static final logger:Ljava/util/logging/Logger;
- # instance fields
- .field private bodyLimit:J
- .field private dispatcher:Lokhttp3/mockwebserver/Dispatcher;
- .field private executor:Ljava/util/concurrent/ExecutorService;
- .field private inetSocketAddress:Ljava/net/InetSocketAddress;
- .field private final openClientSockets:Ljava/util/Set;
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "Ljava/util/Set<",
- "Ljava/net/Socket;",
- ">;"
- }
- .end annotation
- .end field
- .field private final openConnections:Ljava/util/Set;
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "Ljava/util/Set<",
- "Lokhttp3/internal/http2/Http2Connection;",
- ">;"
- }
- .end annotation
- .end field
- .field private port:I
- .field private protocolNegotiationEnabled:Z
- .field private protocols:Ljava/util/List;
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "Ljava/util/List<",
- "Lokhttp3/Protocol;",
- ">;"
- }
- .end annotation
- .end field
- .field private final requestCount:Ljava/util/concurrent/atomic/AtomicInteger;
- .field private final requestQueue:Ljava/util/concurrent/BlockingQueue;
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "Ljava/util/concurrent/BlockingQueue<",
- "Lokhttp3/mockwebserver/RecordedRequest;",
- ">;"
- }
- .end annotation
- .end field
- .field private serverSocket:Ljava/net/ServerSocket;
- .field private serverSocketFactory:Ljavax/net/ServerSocketFactory;
- .field private sslSocketFactory:Ljavax/net/ssl/SSLSocketFactory;
- .field private started:Z
- .field private tunnelProxy:Z
- # direct methods
- .method static constructor <clinit>()V
- .locals 1
- invoke-static {}, Lokhttp3/internal/Internal;->initializeInstanceForTests()V
- new-instance v0, Lokhttp3/mockwebserver/MockWebServer$1;
- invoke-direct {v0}, Lokhttp3/mockwebserver/MockWebServer$1;-><init>()V
- sput-object v0, Lokhttp3/mockwebserver/MockWebServer;->UNTRUSTED_TRUST_MANAGER:Ljavax/net/ssl/X509TrustManager;
- const-class v0, Lokhttp3/mockwebserver/MockWebServer;
- invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String;
- move-result-object v0
- invoke-static {v0}, Ljava/util/logging/Logger;->getLogger(Ljava/lang/String;)Ljava/util/logging/Logger;
- move-result-object v0
- sput-object v0, Lokhttp3/mockwebserver/MockWebServer;->logger:Ljava/util/logging/Logger;
- return-void
- .end method
- .method public constructor <init>()V
- .locals 4
- invoke-direct {p0}, Lorg/junit/rules/ExternalResource;-><init>()V
- new-instance v0, Ljava/util/concurrent/LinkedBlockingQueue;
- invoke-direct {v0}, Ljava/util/concurrent/LinkedBlockingQueue;-><init>()V
- iput-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->requestQueue:Ljava/util/concurrent/BlockingQueue;
- new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
- invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
- invoke-static {v0}, Ljava/util/Collections;->newSetFromMap(Ljava/util/Map;)Ljava/util/Set;
- move-result-object v0
- iput-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->openClientSockets:Ljava/util/Set;
- new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
- invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
- invoke-static {v0}, Ljava/util/Collections;->newSetFromMap(Ljava/util/Map;)Ljava/util/Set;
- move-result-object v0
- iput-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->openConnections:Ljava/util/Set;
- new-instance v0, Ljava/util/concurrent/atomic/AtomicInteger;
- invoke-direct {v0}, Ljava/util/concurrent/atomic/AtomicInteger;-><init>()V
- iput-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->requestCount:Ljava/util/concurrent/atomic/AtomicInteger;
- const-wide v0, 0x7fffffffffffffffL
- iput-wide v0, p0, Lokhttp3/mockwebserver/MockWebServer;->bodyLimit:J
- invoke-static {}, Ljavax/net/ServerSocketFactory;->getDefault()Ljavax/net/ServerSocketFactory;
- move-result-object v0
- iput-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->serverSocketFactory:Ljavax/net/ServerSocketFactory;
- new-instance v0, Lokhttp3/mockwebserver/QueueDispatcher;
- invoke-direct {v0}, Lokhttp3/mockwebserver/QueueDispatcher;-><init>()V
- iput-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->dispatcher:Lokhttp3/mockwebserver/Dispatcher;
- const/4 v0, -0x1
- iput v0, p0, Lokhttp3/mockwebserver/MockWebServer;->port:I
- const/4 v0, 0x1
- iput-boolean v0, p0, Lokhttp3/mockwebserver/MockWebServer;->protocolNegotiationEnabled:Z
- const/4 v1, 0x2
- new-array v1, v1, [Lokhttp3/Protocol;
- sget-object v2, Lokhttp3/Protocol;->HTTP_2:Lokhttp3/Protocol;
- const/4 v3, 0x0
- aput-object v2, v1, v3
- sget-object v2, Lokhttp3/Protocol;->HTTP_1_1:Lokhttp3/Protocol;
- aput-object v2, v1, v0
- invoke-static {v1}, Lokhttp3/internal/Util;->immutableList([Ljava/lang/Object;)Ljava/util/List;
- move-result-object v0
- iput-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->protocols:Ljava/util/List;
- return-void
- .end method
- .method static synthetic access$000()Ljava/util/logging/Logger;
- .locals 1
- sget-object v0, Lokhttp3/mockwebserver/MockWebServer;->logger:Ljava/util/logging/Logger;
- return-object v0
- .end method
- .method static synthetic access$100(Lokhttp3/mockwebserver/MockWebServer;)Ljava/net/ServerSocket;
- .locals 0
- iget-object p0, p0, Lokhttp3/mockwebserver/MockWebServer;->serverSocket:Ljava/net/ServerSocket;
- return-object p0
- .end method
- .method static synthetic access$1000(Lokhttp3/mockwebserver/MockWebServer;Ljava/net/Socket;)V
- .locals 0
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/lang/Exception;
- }
- .end annotation
- invoke-direct {p0, p1}, Lokhttp3/mockwebserver/MockWebServer;->processHandshakeFailure(Ljava/net/Socket;)V
- return-void
- .end method
- .method static synthetic access$1100(Lokhttp3/mockwebserver/MockWebServer;)Z
- .locals 0
- iget-boolean p0, p0, Lokhttp3/mockwebserver/MockWebServer;->protocolNegotiationEnabled:Z
- return p0
- .end method
- .method static synthetic access$1200(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/List;
- .locals 0
- iget-object p0, p0, Lokhttp3/mockwebserver/MockWebServer;->protocols:Ljava/util/List;
- return-object p0
- .end method
- .method static synthetic access$1400(Lokhttp3/mockwebserver/MockWebServer;Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;I)Lokhttp3/mockwebserver/RecordedRequest;
- .locals 0
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- invoke-direct {p0, p1, p2, p3, p4}, Lokhttp3/mockwebserver/MockWebServer;->readRequest(Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;I)Lokhttp3/mockwebserver/RecordedRequest;
- move-result-object p0
- return-object p0
- .end method
- .method static synthetic access$1500(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/concurrent/atomic/AtomicInteger;
- .locals 0
- iget-object p0, p0, Lokhttp3/mockwebserver/MockWebServer;->requestCount:Ljava/util/concurrent/atomic/AtomicInteger;
- return-object p0
- .end method
- .method static synthetic access$1600(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/concurrent/BlockingQueue;
- .locals 0
- iget-object p0, p0, Lokhttp3/mockwebserver/MockWebServer;->requestQueue:Ljava/util/concurrent/BlockingQueue;
- return-object p0
- .end method
- .method static synthetic access$1700(Lokhttp3/mockwebserver/MockWebServer;Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;Lokhttp3/mockwebserver/RecordedRequest;Lokhttp3/mockwebserver/MockResponse;)V
- .locals 0
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- invoke-direct/range {p0 .. p5}, Lokhttp3/mockwebserver/MockWebServer;->handleWebSocketUpgrade(Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;Lokhttp3/mockwebserver/RecordedRequest;Lokhttp3/mockwebserver/MockResponse;)V
- return-void
- .end method
- .method static synthetic access$1800(Lokhttp3/mockwebserver/MockWebServer;Ljava/net/Socket;Lokio/BufferedSink;Lokhttp3/mockwebserver/MockResponse;)V
- .locals 0
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- invoke-direct {p0, p1, p2, p3}, Lokhttp3/mockwebserver/MockWebServer;->writeHttpResponse(Ljava/net/Socket;Lokio/BufferedSink;Lokhttp3/mockwebserver/MockResponse;)V
- return-void
- .end method
- .method static synthetic access$200(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/Set;
- .locals 0
- iget-object p0, p0, Lokhttp3/mockwebserver/MockWebServer;->openClientSockets:Ljava/util/Set;
- return-object p0
- .end method
- .method static synthetic access$2100(Lokhttp3/mockwebserver/MockWebServer;Lokhttp3/mockwebserver/MockResponse;Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;JZ)V
- .locals 0
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- invoke-direct/range {p0 .. p7}, Lokhttp3/mockwebserver/MockWebServer;->throttledTransfer(Lokhttp3/mockwebserver/MockResponse;Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;JZ)V
- return-void
- .end method
- .method static synthetic access$2200(Lokhttp3/mockwebserver/MockWebServer;J)V
- .locals 0
- invoke-direct {p0, p1, p2}, Lokhttp3/mockwebserver/MockWebServer;->sleepIfDelayed(J)V
- return-void
- .end method
- .method static synthetic access$300(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/Set;
- .locals 0
- iget-object p0, p0, Lokhttp3/mockwebserver/MockWebServer;->openConnections:Ljava/util/Set;
- return-object p0
- .end method
- .method static synthetic access$400(Lokhttp3/mockwebserver/MockWebServer;)Lokhttp3/mockwebserver/Dispatcher;
- .locals 0
- iget-object p0, p0, Lokhttp3/mockwebserver/MockWebServer;->dispatcher:Lokhttp3/mockwebserver/Dispatcher;
- return-object p0
- .end method
- .method static synthetic access$500(Lokhttp3/mockwebserver/MockWebServer;)Ljava/util/concurrent/ExecutorService;
- .locals 0
- iget-object p0, p0, Lokhttp3/mockwebserver/MockWebServer;->executor:Ljava/util/concurrent/ExecutorService;
- return-object p0
- .end method
- .method static synthetic access$600(Lokhttp3/mockwebserver/MockWebServer;ILjava/net/Socket;)V
- .locals 0
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/lang/InterruptedException;
- }
- .end annotation
- invoke-direct {p0, p1, p2}, Lokhttp3/mockwebserver/MockWebServer;->dispatchBookkeepingRequest(ILjava/net/Socket;)V
- return-void
- .end method
- .method static synthetic access$700(Lokhttp3/mockwebserver/MockWebServer;Ljava/net/Socket;)V
- .locals 0
- invoke-direct {p0, p1}, Lokhttp3/mockwebserver/MockWebServer;->serveConnection(Ljava/net/Socket;)V
- return-void
- .end method
- .method static synthetic access$800(Lokhttp3/mockwebserver/MockWebServer;)Ljavax/net/ssl/SSLSocketFactory;
- .locals 0
- iget-object p0, p0, Lokhttp3/mockwebserver/MockWebServer;->sslSocketFactory:Ljavax/net/ssl/SSLSocketFactory;
- return-object p0
- .end method
- .method static synthetic access$900(Lokhttp3/mockwebserver/MockWebServer;)Z
- .locals 0
- iget-boolean p0, p0, Lokhttp3/mockwebserver/MockWebServer;->tunnelProxy:Z
- return p0
- .end method
- .method private dispatchBookkeepingRequest(ILjava/net/Socket;)V
- .locals 10
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/lang/InterruptedException;
- }
- .end annotation
- new-instance v9, Lokhttp3/mockwebserver/RecordedRequest;
- const/4 v1, 0x0
- const/4 v2, 0x0
- const/4 v3, 0x0
- const-wide/16 v4, -0x1
- const/4 v6, 0x0
- move-object v0, v9
- move v7, p1
- move-object v8, p2
- invoke-direct/range {v0 .. v8}, Lokhttp3/mockwebserver/RecordedRequest;-><init>(Ljava/lang/String;Lokhttp3/Headers;Ljava/util/List;JLokio/Buffer;ILjava/net/Socket;)V
- iget-object p1, p0, Lokhttp3/mockwebserver/MockWebServer;->requestCount:Ljava/util/concurrent/atomic/AtomicInteger;
- invoke-virtual {p1}, Ljava/util/concurrent/atomic/AtomicInteger;->incrementAndGet()I
- iget-object p1, p0, Lokhttp3/mockwebserver/MockWebServer;->requestQueue:Ljava/util/concurrent/BlockingQueue;
- invoke-interface {p1, v9}, Ljava/util/concurrent/BlockingQueue;->add(Ljava/lang/Object;)Z
- iget-object p1, p0, Lokhttp3/mockwebserver/MockWebServer;->dispatcher:Lokhttp3/mockwebserver/Dispatcher;
- invoke-virtual {p1, v9}, Lokhttp3/mockwebserver/Dispatcher;->dispatch(Lokhttp3/mockwebserver/RecordedRequest;)Lokhttp3/mockwebserver/MockResponse;
- return-void
- .end method
- .method private handleWebSocketUpgrade(Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;Lokhttp3/mockwebserver/RecordedRequest;Lokhttp3/mockwebserver/MockResponse;)V
- .locals 10
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- const-string v0, "Sec-WebSocket-Key"
- invoke-virtual {p4, v0}, Lokhttp3/mockwebserver/RecordedRequest;->getHeader(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- invoke-static {v0}, Lokhttp3/internal/ws/WebSocketProtocol;->acceptHeader(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- const-string v1, "Sec-WebSocket-Accept"
- invoke-virtual {p5, v1, v0}, Lokhttp3/mockwebserver/MockResponse;->setHeader(Ljava/lang/String;Ljava/lang/Object;)Lokhttp3/mockwebserver/MockResponse;
- invoke-direct {p0, p1, p3, p5}, Lokhttp3/mockwebserver/MockWebServer;->writeHttpResponse(Ljava/net/Socket;Lokio/BufferedSink;Lokhttp3/mockwebserver/MockResponse;)V
- invoke-virtual {p4}, Lokhttp3/mockwebserver/RecordedRequest;->getTlsVersion()Lokhttp3/TlsVersion;
- move-result-object p1
- if-eqz p1, :cond_0
- const-string p1, "https"
- goto :goto_0
- :cond_0
- const-string p1, "http"
- :goto_0
- const-string v0, "Host"
- invoke-virtual {p4, v0}, Lokhttp3/mockwebserver/RecordedRequest;->getHeader(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- new-instance v1, Lokhttp3/Request$Builder;
- invoke-direct {v1}, Lokhttp3/Request$Builder;-><init>()V
- new-instance v2, Ljava/lang/StringBuilder;
- invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- const-string p1, "://"
- invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- const-string p1, "/"
- invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p1
- invoke-virtual {v1, p1}, Lokhttp3/Request$Builder;->url(Ljava/lang/String;)Lokhttp3/Request$Builder;
- move-result-object p1
- invoke-virtual {p4}, Lokhttp3/mockwebserver/RecordedRequest;->getHeaders()Lokhttp3/Headers;
- move-result-object v0
- invoke-virtual {p1, v0}, Lokhttp3/Request$Builder;->headers(Lokhttp3/Headers;)Lokhttp3/Request$Builder;
- move-result-object p1
- invoke-virtual {p1}, Lokhttp3/Request$Builder;->build()Lokhttp3/Request;
- move-result-object p1
- new-instance v0, Lokhttp3/Response$Builder;
- invoke-direct {v0}, Lokhttp3/Response$Builder;-><init>()V
- invoke-virtual {p5}, Lokhttp3/mockwebserver/MockResponse;->getStatus()Ljava/lang/String;
- move-result-object v1
- const-string v2, " "
- invoke-virtual {v1, v2}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;
- move-result-object v1
- const/4 v3, 0x1
- aget-object v1, v1, v3
- invoke-static {v1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
- move-result v1
- invoke-virtual {v0, v1}, Lokhttp3/Response$Builder;->code(I)Lokhttp3/Response$Builder;
- move-result-object v0
- invoke-virtual {p5}, Lokhttp3/mockwebserver/MockResponse;->getStatus()Ljava/lang/String;
- move-result-object v1
- const/4 v4, 0x3
- invoke-virtual {v1, v2, v4}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String;
- move-result-object v1
- const/4 v2, 0x2
- aget-object v1, v1, v2
- invoke-virtual {v0, v1}, Lokhttp3/Response$Builder;->message(Ljava/lang/String;)Lokhttp3/Response$Builder;
- move-result-object v0
- invoke-virtual {p5}, Lokhttp3/mockwebserver/MockResponse;->getHeaders()Lokhttp3/Headers;
- move-result-object v1
- invoke-virtual {v0, v1}, Lokhttp3/Response$Builder;->headers(Lokhttp3/Headers;)Lokhttp3/Response$Builder;
- move-result-object v0
- invoke-virtual {v0, p1}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
- move-result-object v0
- sget-object v1, Lokhttp3/Protocol;->HTTP_1_1:Lokhttp3/Protocol;
- invoke-virtual {v0, v1}, Lokhttp3/Response$Builder;->protocol(Lokhttp3/Protocol;)Lokhttp3/Response$Builder;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
- move-result-object v0
- new-instance v1, Ljava/util/concurrent/CountDownLatch;
- invoke-direct {v1, v3}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V
- new-instance v2, Lokhttp3/mockwebserver/MockWebServer$4;
- const/4 v6, 0x0
- move-object v4, v2
- move-object v5, p0
- move-object v7, p2
- move-object v8, p3
- move-object v9, v1
- invoke-direct/range {v4 .. v9}, Lokhttp3/mockwebserver/MockWebServer$4;-><init>(Lokhttp3/mockwebserver/MockWebServer;ZLokio/BufferedSource;Lokio/BufferedSink;Ljava/util/concurrent/CountDownLatch;)V
- new-instance p3, Lokhttp3/internal/ws/RealWebSocket;
- invoke-virtual {p5}, Lokhttp3/mockwebserver/MockResponse;->getWebSocketListener()Lokhttp3/WebSocketListener;
- move-result-object v3
- new-instance v4, Ljava/security/SecureRandom;
- invoke-direct {v4}, Ljava/security/SecureRandom;-><init>()V
- invoke-direct {p3, p1, v3, v4}, Lokhttp3/internal/ws/RealWebSocket;-><init>(Lokhttp3/Request;Lokhttp3/WebSocketListener;Ljava/util/Random;)V
- invoke-virtual {p5}, Lokhttp3/mockwebserver/MockResponse;->getWebSocketListener()Lokhttp3/WebSocketListener;
- move-result-object p1
- invoke-virtual {p1, p3, v0}, Lokhttp3/WebSocketListener;->onOpen(Lokhttp3/WebSocket;Lokhttp3/Response;)V
- new-instance p1, Ljava/lang/StringBuilder;
- invoke-direct {p1}, Ljava/lang/StringBuilder;-><init>()V
- const-string p5, "MockWebServer WebSocket "
- invoke-virtual {p1, p5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {p4}, Lokhttp3/mockwebserver/RecordedRequest;->getPath()Ljava/lang/String;
- move-result-object p4
- invoke-virtual {p1, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p1
- const-wide/16 p4, 0x0
- invoke-virtual {p3, p1, p4, p5, v2}, Lokhttp3/internal/ws/RealWebSocket;->initReaderAndWriter(Ljava/lang/String;JLokhttp3/internal/ws/RealWebSocket$Streams;)V
- :try_start_0
- invoke-virtual {p3}, Lokhttp3/internal/ws/RealWebSocket;->loopReader()V
- :try_end_0
- .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
- :try_start_1
- invoke-virtual {v1}, Ljava/util/concurrent/CountDownLatch;->await()V
- :try_end_1
- .catch Ljava/lang/InterruptedException; {:try_start_1 .. :try_end_1} :catch_1
- .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
- .catchall {:try_start_1 .. :try_end_1} :catchall_0
- goto :goto_1
- :catchall_0
- move-exception p1
- goto :goto_2
- :catch_0
- move-exception p1
- const/4 p4, 0x0
- :try_start_2
- invoke-virtual {p3, p1, p4}, Lokhttp3/internal/ws/RealWebSocket;->failWebSocket(Ljava/lang/Exception;Lokhttp3/Response;)V
- :try_end_2
- .catchall {:try_start_2 .. :try_end_2} :catchall_0
- :catch_1
- :goto_1
- invoke-static {p2}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
- return-void
- :goto_2
- invoke-static {p2}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
- throw p1
- .end method
- .method private processHandshakeFailure(Ljava/net/Socket;)V
- .locals 5
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/lang/Exception;
- }
- .end annotation
- const-string v0, "TLS"
- invoke-static {v0}, Ljavax/net/ssl/SSLContext;->getInstance(Ljava/lang/String;)Ljavax/net/ssl/SSLContext;
- move-result-object v0
- const/4 v1, 0x1
- new-array v2, v1, [Ljavax/net/ssl/TrustManager;
- sget-object v3, Lokhttp3/mockwebserver/MockWebServer;->UNTRUSTED_TRUST_MANAGER:Ljavax/net/ssl/X509TrustManager;
- const/4 v4, 0x0
- aput-object v3, v2, v4
- new-instance v3, Ljava/security/SecureRandom;
- invoke-direct {v3}, Ljava/security/SecureRandom;-><init>()V
- const/4 v4, 0x0
- invoke-virtual {v0, v4, v2, v3}, Ljavax/net/ssl/SSLContext;->init([Ljavax/net/ssl/KeyManager;[Ljavax/net/ssl/TrustManager;Ljava/security/SecureRandom;)V
- invoke-virtual {v0}, Ljavax/net/ssl/SSLContext;->getSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
- move-result-object v0
- invoke-virtual {p1}, Ljava/net/Socket;->getInetAddress()Ljava/net/InetAddress;
- move-result-object v2
- invoke-virtual {v2}, Ljava/net/InetAddress;->getHostAddress()Ljava/lang/String;
- move-result-object v2
- invoke-virtual {p1}, Ljava/net/Socket;->getPort()I
- move-result v3
- invoke-virtual {v0, p1, v2, v3, v1}, Ljavax/net/ssl/SSLSocketFactory;->createSocket(Ljava/net/Socket;Ljava/lang/String;IZ)Ljava/net/Socket;
- move-result-object p1
- check-cast p1, Ljavax/net/ssl/SSLSocket;
- :try_start_0
- invoke-virtual {p1}, Ljavax/net/ssl/SSLSocket;->startHandshake()V
- new-instance v0, Ljava/lang/AssertionError;
- invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
- throw v0
- :try_end_0
- .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
- :catch_0
- invoke-virtual {p1}, Ljavax/net/ssl/SSLSocket;->close()V
- return-void
- .end method
- .method private readEmptyLine(Lokio/BufferedSource;)V
- .locals 3
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- invoke-interface {p1}, Lokio/BufferedSource;->readUtf8LineStrict()Ljava/lang/String;
- move-result-object p1
- invoke-virtual {p1}, Ljava/lang/String;->length()I
- move-result v0
- if-nez v0, :cond_0
- return-void
- :cond_0
- new-instance v0, Ljava/lang/IllegalStateException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "Expected empty but was: "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p1
- invoke-direct {v0, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw v0
- .end method
- .method private readRequest(Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;I)Lokhttp3/mockwebserver/RecordedRequest;
- .locals 18
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- move-object/from16 v8, p0
- move-object/from16 v9, p2
- move-object/from16 v0, p3
- const/4 v1, 0x0
- :try_start_0
- invoke-interface/range {p2 .. p2}, Lokio/BufferedSource;->readUtf8LineStrict()Ljava/lang/String;
- move-result-object v10
- :try_end_0
- .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
- invoke-virtual {v10}, Ljava/lang/String;->length()I
- move-result v2
- if-nez v2, :cond_0
- return-object v1
- :cond_0
- new-instance v11, Lokhttp3/Headers$Builder;
- invoke-direct {v11}, Lokhttp3/Headers$Builder;-><init>()V
- const-wide/16 v1, -0x1
- const/4 v12, 0x0
- move-wide v5, v1
- const/4 v3, 0x0
- const/4 v4, 0x0
- :cond_1
- :goto_0
- invoke-interface/range {p2 .. p2}, Lokio/BufferedSource;->readUtf8LineStrict()Ljava/lang/String;
- move-result-object v7
- invoke-virtual {v7}, Ljava/lang/String;->length()I
- move-result v13
- if-eqz v13, :cond_4
- sget-object v13, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
- invoke-virtual {v13, v11, v7}, Lokhttp3/internal/Internal;->addLenient(Lokhttp3/Headers$Builder;Ljava/lang/String;)V
- sget-object v13, Ljava/util/Locale;->US:Ljava/util/Locale;
- invoke-virtual {v7, v13}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
- move-result-object v13
- cmp-long v15, v5, v1
- if-nez v15, :cond_2
- const-string v15, "content-length:"
- invoke-virtual {v13, v15}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
- move-result v15
- if-eqz v15, :cond_2
- const/16 v5, 0xf
- invoke-virtual {v7, v5}, Ljava/lang/String;->substring(I)Ljava/lang/String;
- move-result-object v5
- invoke-virtual {v5}, Ljava/lang/String;->trim()Ljava/lang/String;
- move-result-object v5
- invoke-static {v5}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J
- move-result-wide v5
- :cond_2
- const-string v7, "transfer-encoding:"
- invoke-virtual {v13, v7}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
- move-result v7
- if-eqz v7, :cond_3
- const/16 v7, 0x12
- invoke-virtual {v13, v7}, Ljava/lang/String;->substring(I)Ljava/lang/String;
- move-result-object v7
- invoke-virtual {v7}, Ljava/lang/String;->trim()Ljava/lang/String;
- move-result-object v7
- const-string v15, "chunked"
- invoke-virtual {v7, v15}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
- move-result v7
- if-eqz v7, :cond_3
- const/4 v4, 0x1
- :cond_3
- const-string v7, "expect:"
- invoke-virtual {v13, v7}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
- move-result v7
- if-eqz v7, :cond_1
- const/4 v7, 0x7
- invoke-virtual {v13, v7}, Ljava/lang/String;->substring(I)Ljava/lang/String;
- move-result-object v7
- invoke-virtual {v7}, Ljava/lang/String;->trim()Ljava/lang/String;
- move-result-object v7
- const-string v13, "100-continue"
- invoke-virtual {v7, v13}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v7
- if-eqz v7, :cond_1
- const/4 v3, 0x1
- goto :goto_0
- :cond_4
- if-eqz v3, :cond_5
- iget-object v3, v8, Lokhttp3/mockwebserver/MockWebServer;->dispatcher:Lokhttp3/mockwebserver/Dispatcher;
- invoke-virtual {v3}, Lokhttp3/mockwebserver/Dispatcher;->peek()Lokhttp3/mockwebserver/MockResponse;
- move-result-object v3
- invoke-virtual {v3}, Lokhttp3/mockwebserver/MockResponse;->getSocketPolicy()Lokhttp3/mockwebserver/SocketPolicy;
- move-result-object v3
- sget-object v7, Lokhttp3/mockwebserver/SocketPolicy;->EXPECT_CONTINUE:Lokhttp3/mockwebserver/SocketPolicy;
- if-ne v3, v7, :cond_5
- const-string v3, "HTTP/1.1 100 Continue\r\n"
- invoke-interface {v0, v3}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- const-string v3, "Content-Length: 0\r\n"
- invoke-interface {v0, v3}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- const-string v3, "\r\n"
- invoke-interface {v0, v3}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- invoke-interface/range {p3 .. p3}, Lokio/BufferedSink;->flush()V
- :cond_5
- new-instance v13, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;
- iget-wide v14, v8, Lokhttp3/mockwebserver/MockWebServer;->bodyLimit:J
- invoke-direct {v13, v14, v15}, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;-><init>(J)V
- new-instance v14, Ljava/util/ArrayList;
- invoke-direct {v14}, Ljava/util/ArrayList;-><init>()V
- iget-object v0, v8, Lokhttp3/mockwebserver/MockWebServer;->dispatcher:Lokhttp3/mockwebserver/Dispatcher;
- invoke-virtual {v0}, Lokhttp3/mockwebserver/Dispatcher;->peek()Lokhttp3/mockwebserver/MockResponse;
- move-result-object v15
- cmp-long v0, v5, v1
- if-eqz v0, :cond_7
- const-wide/16 v0, 0x0
- cmp-long v2, v5, v0
- if-lez v2, :cond_6
- const/16 v16, 0x1
- goto :goto_1
- :cond_6
- const/16 v16, 0x0
- :goto_1
- invoke-static {v13}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink;
- move-result-object v4
- const/4 v7, 0x1
- move-object/from16 v0, p0
- move-object v1, v15
- move-object/from16 v2, p1
- move-object/from16 v3, p2
- invoke-direct/range {v0 .. v7}, Lokhttp3/mockwebserver/MockWebServer;->throttledTransfer(Lokhttp3/mockwebserver/MockResponse;Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;JZ)V
- goto :goto_3
- :cond_7
- if-eqz v4, :cond_9
- :goto_2
- invoke-interface/range {p2 .. p2}, Lokio/BufferedSource;->readUtf8LineStrict()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v0}, Ljava/lang/String;->trim()Ljava/lang/String;
- move-result-object v0
- const/16 v1, 0x10
- invoke-static {v0, v1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;I)I
- move-result v0
- if-nez v0, :cond_8
- invoke-direct {v8, v9}, Lokhttp3/mockwebserver/MockWebServer;->readEmptyLine(Lokio/BufferedSource;)V
- const/16 v16, 0x1
- goto :goto_3
- :cond_8
- invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
- move-result-object v1
- invoke-interface {v14, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
- invoke-static {v13}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink;
- move-result-object v4
- int-to-long v5, v0
- const/4 v7, 0x1
- move-object/from16 v0, p0
- move-object v1, v15
- move-object/from16 v2, p1
- move-object/from16 v3, p2
- invoke-direct/range {v0 .. v7}, Lokhttp3/mockwebserver/MockWebServer;->throttledTransfer(Lokhttp3/mockwebserver/MockResponse;Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;JZ)V
- invoke-direct {v8, v9}, Lokhttp3/mockwebserver/MockWebServer;->readEmptyLine(Lokio/BufferedSource;)V
- goto :goto_2
- :cond_9
- const/16 v16, 0x0
- :goto_3
- const/16 v0, 0x20
- invoke-virtual {v10, v0}, Ljava/lang/String;->indexOf(I)I
- move-result v0
- invoke-virtual {v10, v12, v0}, Ljava/lang/String;->substring(II)Ljava/lang/String;
- move-result-object v0
- if-eqz v16, :cond_b
- invoke-static {v0}, Lokhttp3/internal/http/HttpMethod;->permitsRequestBody(Ljava/lang/String;)Z
- move-result v0
- if-eqz v0, :cond_a
- goto :goto_4
- :cond_a
- new-instance v0, Ljava/lang/IllegalArgumentException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "Request must not have a body: "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v1
- invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
- throw v0
- :cond_b
- :goto_4
- new-instance v0, Lokhttp3/mockwebserver/RecordedRequest;
- invoke-virtual {v11}, Lokhttp3/Headers$Builder;->build()Lokhttp3/Headers;
- move-result-object v11
- invoke-static {v13}, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->access$1900(Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;)J
- move-result-wide v1
- invoke-static {v13}, Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;->access$2000(Lokhttp3/mockwebserver/MockWebServer$TruncatingBuffer;)Lokio/Buffer;
- move-result-object v15
- move-object v9, v0
- move-object v12, v14
- move-wide v13, v1
- move/from16 v16, p4
- move-object/from16 v17, p1
- invoke-direct/range {v9 .. v17}, Lokhttp3/mockwebserver/RecordedRequest;-><init>(Ljava/lang/String;Lokhttp3/Headers;Ljava/util/List;JLokio/Buffer;ILjava/net/Socket;)V
- return-object v0
- :catch_0
- return-object v1
- .end method
- .method private serveConnection(Ljava/net/Socket;)V
- .locals 5
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->executor:Ljava/util/concurrent/ExecutorService;
- new-instance v1, Lokhttp3/mockwebserver/MockWebServer$3;
- const/4 v2, 0x1
- new-array v2, v2, [Ljava/lang/Object;
- invoke-virtual {p1}, Ljava/net/Socket;->getRemoteSocketAddress()Ljava/net/SocketAddress;
- move-result-object v3
- const/4 v4, 0x0
- aput-object v3, v2, v4
- const-string v3, "MockWebServer %s"
- invoke-direct {v1, p0, v3, v2, p1}, Lokhttp3/mockwebserver/MockWebServer$3;-><init>(Lokhttp3/mockwebserver/MockWebServer;Ljava/lang/String;[Ljava/lang/Object;Ljava/net/Socket;)V
- invoke-interface {v0, v1}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
- return-void
- .end method
- .method private sleepIfDelayed(J)V
- .locals 3
- const-wide/16 v0, 0x0
- cmp-long v2, p1, v0
- if-eqz v2, :cond_0
- :try_start_0
- invoke-static {p1, p2}, Ljava/lang/Thread;->sleep(J)V
- :try_end_0
- .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0
- goto :goto_0
- :catch_0
- move-exception p1
- new-instance p2, Ljava/lang/AssertionError;
- invoke-direct {p2, p1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
- throw p2
- :cond_0
- :goto_0
- return-void
- .end method
- .method private declared-synchronized start(Ljava/net/InetSocketAddress;)V
- .locals 5
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- monitor-enter p0
- :try_start_0
- iget-boolean v0, p0, Lokhttp3/mockwebserver/MockWebServer;->started:Z
- if-nez v0, :cond_1
- const/4 v0, 0x1
- iput-boolean v0, p0, Lokhttp3/mockwebserver/MockWebServer;->started:Z
- const-string v1, "MockWebServer"
- const/4 v2, 0x0
- invoke-static {v1, v2}, Lokhttp3/internal/Util;->threadFactory(Ljava/lang/String;Z)Ljava/util/concurrent/ThreadFactory;
- move-result-object v1
- invoke-static {v1}, Ljava/util/concurrent/Executors;->newCachedThreadPool(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ExecutorService;
- move-result-object v1
- iput-object v1, p0, Lokhttp3/mockwebserver/MockWebServer;->executor:Ljava/util/concurrent/ExecutorService;
- iput-object p1, p0, Lokhttp3/mockwebserver/MockWebServer;->inetSocketAddress:Ljava/net/InetSocketAddress;
- iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer;->serverSocketFactory:Ljavax/net/ServerSocketFactory;
- invoke-virtual {v1}, Ljavax/net/ServerSocketFactory;->createServerSocket()Ljava/net/ServerSocket;
- move-result-object v1
- iput-object v1, p0, Lokhttp3/mockwebserver/MockWebServer;->serverSocket:Ljava/net/ServerSocket;
- iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer;->serverSocket:Ljava/net/ServerSocket;
- invoke-virtual {p1}, Ljava/net/InetSocketAddress;->getPort()I
- move-result v3
- if-eqz v3, :cond_0
- const/4 v3, 0x1
- goto :goto_0
- :cond_0
- const/4 v3, 0x0
- :goto_0
- invoke-virtual {v1, v3}, Ljava/net/ServerSocket;->setReuseAddress(Z)V
- iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer;->serverSocket:Ljava/net/ServerSocket;
- const/16 v3, 0x32
- invoke-virtual {v1, p1, v3}, Ljava/net/ServerSocket;->bind(Ljava/net/SocketAddress;I)V
- iget-object p1, p0, Lokhttp3/mockwebserver/MockWebServer;->serverSocket:Ljava/net/ServerSocket;
- invoke-virtual {p1}, Ljava/net/ServerSocket;->getLocalPort()I
- move-result p1
- iput p1, p0, Lokhttp3/mockwebserver/MockWebServer;->port:I
- iget-object p1, p0, Lokhttp3/mockwebserver/MockWebServer;->executor:Ljava/util/concurrent/ExecutorService;
- new-instance v1, Lokhttp3/mockwebserver/MockWebServer$2;
- const-string v3, "MockWebServer %s"
- new-array v0, v0, [Ljava/lang/Object;
- iget v4, p0, Lokhttp3/mockwebserver/MockWebServer;->port:I
- invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
- move-result-object v4
- aput-object v4, v0, v2
- invoke-direct {v1, p0, v3, v0}, Lokhttp3/mockwebserver/MockWebServer$2;-><init>(Lokhttp3/mockwebserver/MockWebServer;Ljava/lang/String;[Ljava/lang/Object;)V
- invoke-interface {p1, v1}, Ljava/util/concurrent/ExecutorService;->execute(Ljava/lang/Runnable;)V
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
- monitor-exit p0
- return-void
- :cond_1
- :try_start_1
- new-instance p1, Ljava/lang/IllegalStateException;
- const-string v0, "start() already called"
- invoke-direct {p1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw p1
- :try_end_1
- .catchall {:try_start_1 .. :try_end_1} :catchall_0
- :catchall_0
- move-exception p1
- monitor-exit p0
- throw p1
- .end method
- .method private throttledTransfer(Lokhttp3/mockwebserver/MockResponse;Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;JZ)V
- .locals 20
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- const-wide/16 v0, 0x0
- cmp-long v2, p5, v0
- if-nez v2, :cond_0
- return-void
- :cond_0
- new-instance v2, Lokio/Buffer;
- invoke-direct {v2}, Lokio/Buffer;-><init>()V
- invoke-virtual/range {p1 .. p1}, Lokhttp3/mockwebserver/MockResponse;->getThrottleBytesPerPeriod()J
- move-result-wide v3
- sget-object v5, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
- move-object/from16 v6, p1
- invoke-virtual {v6, v5}, Lokhttp3/mockwebserver/MockResponse;->getThrottlePeriod(Ljava/util/concurrent/TimeUnit;)J
- move-result-wide v7
- const-wide/16 v9, 0x2
- div-long v9, p5, v9
- const/4 v5, 0x1
- const/4 v11, 0x0
- invoke-virtual/range {p1 .. p1}, Lokhttp3/mockwebserver/MockResponse;->getSocketPolicy()Lokhttp3/mockwebserver/SocketPolicy;
- move-result-object v6
- if-eqz p7, :cond_1
- sget-object v12, Lokhttp3/mockwebserver/SocketPolicy;->DISCONNECT_DURING_REQUEST_BODY:Lokhttp3/mockwebserver/SocketPolicy;
- if-ne v6, v12, :cond_2
- goto :goto_0
- :cond_1
- sget-object v12, Lokhttp3/mockwebserver/SocketPolicy;->DISCONNECT_DURING_RESPONSE_BODY:Lokhttp3/mockwebserver/SocketPolicy;
- if-ne v6, v12, :cond_2
- goto :goto_0
- :cond_2
- const/4 v5, 0x0
- :goto_0
- move-wide/from16 v12, p5
- :goto_1
- invoke-virtual/range {p2 .. p2}, Ljava/net/Socket;->isClosed()Z
- move-result v6
- if-nez v6, :cond_9
- const/4 v6, 0x0
- :goto_2
- int-to-long v14, v6
- cmp-long v6, v14, v3
- if-gez v6, :cond_7
- sub-long v0, v3, v14
- invoke-static {v12, v13, v0, v1}, Ljava/lang/Math;->min(JJ)J
- move-result-wide v0
- move-wide/from16 v16, v3
- if-eqz v5, :cond_3
- sub-long v3, v12, v9
- invoke-static {v0, v1, v3, v4}, Ljava/lang/Math;->min(JJ)J
- move-result-wide v0
- :cond_3
- move-wide v3, v0
- move-object/from16 v0, p3
- invoke-interface {v0, v2, v3, v4}, Lokio/Source;->read(Lokio/Buffer;J)J
- move-result-wide v3
- const-wide/16 v18, -0x1
- cmp-long v1, v3, v18
- if-nez v1, :cond_4
- return-void
- :cond_4
- move-object/from16 v1, p4
- invoke-interface {v1, v2, v3, v4}, Lokio/Sink;->write(Lokio/Buffer;J)V
- invoke-interface/range {p4 .. p4}, Lokio/BufferedSink;->flush()V
- add-long/2addr v14, v3
- long-to-int v6, v14
- sub-long/2addr v12, v3
- if-eqz v5, :cond_5
- cmp-long v3, v12, v9
- if-nez v3, :cond_5
- invoke-virtual/range {p2 .. p2}, Ljava/net/Socket;->close()V
- return-void
- :cond_5
- const-wide/16 v3, 0x0
- cmp-long v14, v12, v3
- if-nez v14, :cond_6
- return-void
- :cond_6
- move-wide v0, v3
- move-wide/from16 v3, v16
- goto :goto_2
- :cond_7
- move-wide/from16 v16, v3
- move-wide v3, v0
- move-object/from16 v0, p3
- move-object/from16 v1, p4
- cmp-long v6, v7, v3
- if-eqz v6, :cond_8
- :try_start_0
- invoke-static {v7, v8}, Ljava/lang/Thread;->sleep(J)V
- :try_end_0
- .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0
- goto :goto_3
- :catch_0
- new-instance v0, Ljava/lang/AssertionError;
- invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
- throw v0
- :cond_8
- :goto_3
- move-wide v0, v3
- move-wide/from16 v3, v16
- goto :goto_1
- :cond_9
- return-void
- .end method
- .method private writeHttpResponse(Ljava/net/Socket;Lokio/BufferedSink;Lokhttp3/mockwebserver/MockResponse;)V
- .locals 12
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
- invoke-virtual {p3, v0}, Lokhttp3/mockwebserver/MockResponse;->getBodyDelay(Ljava/util/concurrent/TimeUnit;)J
- move-result-wide v0
- invoke-direct {p0, v0, v1}, Lokhttp3/mockwebserver/MockWebServer;->sleepIfDelayed(J)V
- invoke-virtual {p3}, Lokhttp3/mockwebserver/MockResponse;->getStatus()Ljava/lang/String;
- move-result-object v0
- invoke-interface {p2, v0}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- const-string v0, "\r\n"
- invoke-interface {p2, v0}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- invoke-virtual {p3}, Lokhttp3/mockwebserver/MockResponse;->getHeaders()Lokhttp3/Headers;
- move-result-object v1
- invoke-virtual {v1}, Lokhttp3/Headers;->size()I
- move-result v2
- const/4 v3, 0x0
- :goto_0
- if-ge v3, v2, :cond_0
- invoke-virtual {v1, v3}, Lokhttp3/Headers;->name(I)Ljava/lang/String;
- move-result-object v4
- invoke-interface {p2, v4}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- const-string v4, ": "
- invoke-interface {p2, v4}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- invoke-virtual {v1, v3}, Lokhttp3/Headers;->value(I)Ljava/lang/String;
- move-result-object v4
- invoke-interface {p2, v4}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- invoke-interface {p2, v0}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- add-int/lit8 v3, v3, 0x1
- goto :goto_0
- :cond_0
- invoke-interface {p2, v0}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- invoke-interface {p2}, Lokio/BufferedSink;->flush()V
- invoke-virtual {p3}, Lokhttp3/mockwebserver/MockResponse;->getBody()Lokio/Buffer;
- move-result-object v7
- if-nez v7, :cond_1
- return-void
- :cond_1
- sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
- invoke-virtual {p3, v0}, Lokhttp3/mockwebserver/MockResponse;->getBodyDelay(Ljava/util/concurrent/TimeUnit;)J
- move-result-wide v0
- invoke-direct {p0, v0, v1}, Lokhttp3/mockwebserver/MockWebServer;->sleepIfDelayed(J)V
- invoke-virtual {v7}, Lokio/Buffer;->size()J
- move-result-wide v9
- const/4 v11, 0x0
- move-object v4, p0
- move-object v5, p3
- move-object v6, p1
- move-object v8, p2
- invoke-direct/range {v4 .. v11}, Lokhttp3/mockwebserver/MockWebServer;->throttledTransfer(Lokhttp3/mockwebserver/MockResponse;Ljava/net/Socket;Lokio/BufferedSource;Lokio/BufferedSink;JZ)V
- return-void
- .end method
- # virtual methods
- .method protected declared-synchronized after()V
- .locals 4
- monitor-enter p0
- :try_start_0
- invoke-virtual {p0}, Lokhttp3/mockwebserver/MockWebServer;->shutdown()V
- :try_end_0
- .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
- goto :goto_0
- :catchall_0
- move-exception v0
- goto :goto_1
- :catch_0
- move-exception v0
- :try_start_1
- sget-object v1, Lokhttp3/mockwebserver/MockWebServer;->logger:Ljava/util/logging/Logger;
- sget-object v2, Ljava/util/logging/Level;->WARNING:Ljava/util/logging/Level;
- const-string v3, "MockWebServer shutdown failed"
- invoke-virtual {v1, v2, v3, v0}, Ljava/util/logging/Logger;->log(Ljava/util/logging/Level;Ljava/lang/String;Ljava/lang/Throwable;)V
- :try_end_1
- .catchall {:try_start_1 .. :try_end_1} :catchall_0
- :goto_0
- monitor-exit p0
- return-void
- :goto_1
- monitor-exit p0
- throw v0
- .end method
- .method protected declared-synchronized before()V
- .locals 2
- monitor-enter p0
- :try_start_0
- iget-boolean v0, p0, Lokhttp3/mockwebserver/MockWebServer;->started:Z
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
- if-eqz v0, :cond_0
- monitor-exit p0
- return-void
- :cond_0
- :try_start_1
- invoke-virtual {p0}, Lokhttp3/mockwebserver/MockWebServer;->start()V
- :try_end_1
- .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
- .catchall {:try_start_1 .. :try_end_1} :catchall_0
- monitor-exit p0
- return-void
- :catch_0
- move-exception v0
- :try_start_2
- new-instance v1, Ljava/lang/RuntimeException;
- invoke-direct {v1, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V
- throw v1
- :try_end_2
- .catchall {:try_start_2 .. :try_end_2} :catchall_0
- :catchall_0
- move-exception v0
- monitor-exit p0
- throw v0
- .end method
- .method public close()V
- .locals 0
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- invoke-virtual {p0}, Lokhttp3/mockwebserver/MockWebServer;->shutdown()V
- return-void
- .end method
- .method public enqueue(Lokhttp3/mockwebserver/MockResponse;)V
- .locals 1
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->dispatcher:Lokhttp3/mockwebserver/Dispatcher;
- check-cast v0, Lokhttp3/mockwebserver/QueueDispatcher;
- invoke-virtual {p1}, Lokhttp3/mockwebserver/MockResponse;->clone()Lokhttp3/mockwebserver/MockResponse;
- move-result-object p1
- invoke-virtual {v0, p1}, Lokhttp3/mockwebserver/QueueDispatcher;->enqueueResponse(Lokhttp3/mockwebserver/MockResponse;)V
- return-void
- .end method
- .method public getHostName()Ljava/lang/String;
- .locals 1
- invoke-virtual {p0}, Lokhttp3/mockwebserver/MockWebServer;->before()V
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->inetSocketAddress:Ljava/net/InetSocketAddress;
- invoke-virtual {v0}, Ljava/net/InetSocketAddress;->getAddress()Ljava/net/InetAddress;
- move-result-object v0
- invoke-virtual {v0}, Ljava/net/InetAddress;->getCanonicalHostName()Ljava/lang/String;
- move-result-object v0
- return-object v0
- .end method
- .method public getPort()I
- .locals 1
- invoke-virtual {p0}, Lokhttp3/mockwebserver/MockWebServer;->before()V
- iget v0, p0, Lokhttp3/mockwebserver/MockWebServer;->port:I
- return v0
- .end method
- .method public getRequestCount()I
- .locals 1
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->requestCount:Ljava/util/concurrent/atomic/AtomicInteger;
- invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicInteger;->get()I
- move-result v0
- return v0
- .end method
- .method public setBodyLimit(J)V
- .locals 0
- iput-wide p1, p0, Lokhttp3/mockwebserver/MockWebServer;->bodyLimit:J
- return-void
- .end method
- .method public setDispatcher(Lokhttp3/mockwebserver/Dispatcher;)V
- .locals 0
- if-eqz p1, :cond_0
- iput-object p1, p0, Lokhttp3/mockwebserver/MockWebServer;->dispatcher:Lokhttp3/mockwebserver/Dispatcher;
- return-void
- :cond_0
- new-instance p1, Ljava/lang/NullPointerException;
- invoke-direct {p1}, Ljava/lang/NullPointerException;-><init>()V
- throw p1
- .end method
- .method public setProtocolNegotiationEnabled(Z)V
- .locals 0
- iput-boolean p1, p0, Lokhttp3/mockwebserver/MockWebServer;->protocolNegotiationEnabled:Z
- return-void
- .end method
- .method public setProtocols(Ljava/util/List;)V
- .locals 3
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "(",
- "Ljava/util/List<",
- "Lokhttp3/Protocol;",
- ">;)V"
- }
- .end annotation
- invoke-static {p1}, Lokhttp3/internal/Util;->immutableList(Ljava/util/List;)Ljava/util/List;
- move-result-object p1
- sget-object v0, Lokhttp3/Protocol;->HTTP_1_1:Lokhttp3/Protocol;
- invoke-interface {p1, v0}, Ljava/util/List;->contains(Ljava/lang/Object;)Z
- move-result v0
- if-eqz v0, :cond_1
- const/4 v0, 0x0
- invoke-interface {p1, v0}, Ljava/util/List;->contains(Ljava/lang/Object;)Z
- move-result v0
- if-nez v0, :cond_0
- iput-object p1, p0, Lokhttp3/mockwebserver/MockWebServer;->protocols:Ljava/util/List;
- return-void
- :cond_0
- new-instance p1, Ljava/lang/IllegalArgumentException;
- const-string v0, "protocols must not contain null"
- invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
- throw p1
- :cond_1
- new-instance v0, Ljava/lang/IllegalArgumentException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "protocols doesn\'t contain http/1.1: "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p1
- invoke-direct {v0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
- throw v0
- .end method
- .method public setServerSocketFactory(Ljavax/net/ServerSocketFactory;)V
- .locals 1
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->executor:Ljava/util/concurrent/ExecutorService;
- if-nez v0, :cond_0
- iput-object p1, p0, Lokhttp3/mockwebserver/MockWebServer;->serverSocketFactory:Ljavax/net/ServerSocketFactory;
- return-void
- :cond_0
- new-instance p1, Ljava/lang/IllegalStateException;
- const-string v0, "setServerSocketFactory() must be called before start()"
- invoke-direct {p1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw p1
- .end method
- .method public declared-synchronized shutdown()V
- .locals 4
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- monitor-enter p0
- :try_start_0
- iget-boolean v0, p0, Lokhttp3/mockwebserver/MockWebServer;->started:Z
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
- if-nez v0, :cond_0
- monitor-exit p0
- return-void
- :cond_0
- :try_start_1
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->serverSocket:Ljava/net/ServerSocket;
- if-eqz v0, :cond_2
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->serverSocket:Ljava/net/ServerSocket;
- invoke-virtual {v0}, Ljava/net/ServerSocket;->close()V
- :try_end_1
- .catchall {:try_start_1 .. :try_end_1} :catchall_0
- :try_start_2
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->executor:Ljava/util/concurrent/ExecutorService;
- const-wide/16 v1, 0x5
- sget-object v3, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
- invoke-interface {v0, v1, v2, v3}, Ljava/util/concurrent/ExecutorService;->awaitTermination(JLjava/util/concurrent/TimeUnit;)Z
- move-result v0
- :try_end_2
- .catch Ljava/lang/InterruptedException; {:try_start_2 .. :try_end_2} :catch_0
- .catchall {:try_start_2 .. :try_end_2} :catchall_0
- if-eqz v0, :cond_1
- monitor-exit p0
- return-void
- :cond_1
- :try_start_3
- new-instance v0, Ljava/io/IOException;
- const-string v1, "Gave up waiting for executor to shut down"
- invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
- throw v0
- :try_end_3
- .catch Ljava/lang/InterruptedException; {:try_start_3 .. :try_end_3} :catch_0
- .catchall {:try_start_3 .. :try_end_3} :catchall_0
- :catch_0
- :try_start_4
- new-instance v0, Ljava/lang/AssertionError;
- invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
- throw v0
- :cond_2
- new-instance v0, Ljava/lang/IllegalStateException;
- const-string v1, "shutdown() before start()"
- invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw v0
- :try_end_4
- .catchall {:try_start_4 .. :try_end_4} :catchall_0
- :catchall_0
- move-exception v0
- monitor-exit p0
- throw v0
- .end method
- .method public start()V
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- const/4 v0, 0x0
- invoke-virtual {p0, v0}, Lokhttp3/mockwebserver/MockWebServer;->start(I)V
- return-void
- .end method
- .method public start(I)V
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- const-string v0, "localhost"
- invoke-static {v0}, Ljava/net/InetAddress;->getByName(Ljava/lang/String;)Ljava/net/InetAddress;
- move-result-object v0
- invoke-virtual {p0, v0, p1}, Lokhttp3/mockwebserver/MockWebServer;->start(Ljava/net/InetAddress;I)V
- return-void
- .end method
- .method public start(Ljava/net/InetAddress;I)V
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- new-instance v0, Ljava/net/InetSocketAddress;
- invoke-direct {v0, p1, p2}, Ljava/net/InetSocketAddress;-><init>(Ljava/net/InetAddress;I)V
- invoke-direct {p0, v0}, Lokhttp3/mockwebserver/MockWebServer;->start(Ljava/net/InetSocketAddress;)V
- return-void
- .end method
- .method public takeRequest()Lokhttp3/mockwebserver/RecordedRequest;
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/lang/InterruptedException;
- }
- .end annotation
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->requestQueue:Ljava/util/concurrent/BlockingQueue;
- invoke-interface {v0}, Ljava/util/concurrent/BlockingQueue;->take()Ljava/lang/Object;
- move-result-object v0
- check-cast v0, Lokhttp3/mockwebserver/RecordedRequest;
- return-object v0
- .end method
- .method public takeRequest(JLjava/util/concurrent/TimeUnit;)Lokhttp3/mockwebserver/RecordedRequest;
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/lang/InterruptedException;
- }
- .end annotation
- iget-object v0, p0, Lokhttp3/mockwebserver/MockWebServer;->requestQueue:Ljava/util/concurrent/BlockingQueue;
- invoke-interface {v0, p1, p2, p3}, Ljava/util/concurrent/BlockingQueue;->poll(JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;
- move-result-object p1
- check-cast p1, Lokhttp3/mockwebserver/RecordedRequest;
- return-object p1
- .end method
- .method public toProxyAddress()Ljava/net/Proxy;
- .locals 3
- invoke-virtual {p0}, Lokhttp3/mockwebserver/MockWebServer;->before()V
- new-instance v0, Ljava/net/InetSocketAddress;
- iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer;->inetSocketAddress:Ljava/net/InetSocketAddress;
- invoke-virtual {v1}, Ljava/net/InetSocketAddress;->getAddress()Ljava/net/InetAddress;
- move-result-object v1
- invoke-virtual {v1}, Ljava/net/InetAddress;->getCanonicalHostName()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {p0}, Lokhttp3/mockwebserver/MockWebServer;->getPort()I
- move-result v2
- invoke-direct {v0, v1, v2}, Ljava/net/InetSocketAddress;-><init>(Ljava/lang/String;I)V
- new-instance v1, Ljava/net/Proxy;
- sget-object v2, Ljava/net/Proxy$Type;->HTTP:Ljava/net/Proxy$Type;
- invoke-direct {v1, v2, v0}, Ljava/net/Proxy;-><init>(Ljava/net/Proxy$Type;Ljava/net/SocketAddress;)V
- return-object v1
- .end method
- .method public toString()Ljava/lang/String;
- .locals 2
- new-instance v0, Ljava/lang/StringBuilder;
- invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
- const-string v1, "MockWebServer["
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget v1, p0, Lokhttp3/mockwebserver/MockWebServer;->port:I
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
- const-string v1, "]"
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v0
- return-object v0
- .end method
- .method public url(Ljava/lang/String;)Lokhttp3/HttpUrl;
- .locals 2
- new-instance v0, Lokhttp3/HttpUrl$Builder;
- invoke-direct {v0}, Lokhttp3/HttpUrl$Builder;-><init>()V
- iget-object v1, p0, Lokhttp3/mockwebserver/MockWebServer;->sslSocketFactory:Ljavax/net/ssl/SSLSocketFactory;
- if-eqz v1, :cond_0
- const-string v1, "https"
- goto :goto_0
- :cond_0
- const-string v1, "http"
- :goto_0
- invoke-virtual {v0, v1}, Lokhttp3/HttpUrl$Builder;->scheme(Ljava/lang/String;)Lokhttp3/HttpUrl$Builder;
- move-result-object v0
- invoke-virtual {p0}, Lokhttp3/mockwebserver/MockWebServer;->getHostName()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {v0, v1}, Lokhttp3/HttpUrl$Builder;->host(Ljava/lang/String;)Lokhttp3/HttpUrl$Builder;
- move-result-object v0
- invoke-virtual {p0}, Lokhttp3/mockwebserver/MockWebServer;->getPort()I
- move-result v1
- invoke-virtual {v0, v1}, Lokhttp3/HttpUrl$Builder;->port(I)Lokhttp3/HttpUrl$Builder;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/HttpUrl$Builder;->build()Lokhttp3/HttpUrl;
- move-result-object v0
- invoke-virtual {v0, p1}, Lokhttp3/HttpUrl;->resolve(Ljava/lang/String;)Lokhttp3/HttpUrl;
- move-result-object p1
- return-object p1
- .end method
- .method public useHttps(Ljavax/net/ssl/SSLSocketFactory;Z)V
- .locals 0
- iput-object p1, p0, Lokhttp3/mockwebserver/MockWebServer;->sslSocketFactory:Ljavax/net/ssl/SSLSocketFactory;
- iput-boolean p2, p0, Lokhttp3/mockwebserver/MockWebServer;->tunnelProxy:Z
- return-void
- .end method
|