123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- .class public final Lokhttp3/internal/connection/ConnectionSpecSelector;
- .super Ljava/lang/Object;
- .source ""
- # instance fields
- .field private final connectionSpecs:Ljava/util/List;
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "Ljava/util/List<",
- "Lokhttp3/ConnectionSpec;",
- ">;"
- }
- .end annotation
- .end field
- .field private isFallback:Z
- .field private isFallbackPossible:Z
- .field private nextModeIndex:I
- # direct methods
- .method public constructor <init>(Ljava/util/List;)V
- .locals 1
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "(",
- "Ljava/util/List<",
- "Lokhttp3/ConnectionSpec;",
- ">;)V"
- }
- .end annotation
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- const/4 v0, 0x0
- iput v0, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->nextModeIndex:I
- iput-object p1, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->connectionSpecs:Ljava/util/List;
- return-void
- .end method
- .method private isFallbackPossible(Ljavax/net/ssl/SSLSocket;)Z
- .locals 2
- iget v0, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->nextModeIndex:I
- :goto_0
- iget-object v1, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->connectionSpecs:Ljava/util/List;
- invoke-interface {v1}, Ljava/util/List;->size()I
- move-result v1
- if-ge v0, v1, :cond_1
- iget-object v1, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->connectionSpecs:Ljava/util/List;
- invoke-interface {v1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
- move-result-object v1
- check-cast v1, Lokhttp3/ConnectionSpec;
- invoke-virtual {v1, p1}, Lokhttp3/ConnectionSpec;->isCompatible(Ljavax/net/ssl/SSLSocket;)Z
- move-result v1
- if-eqz v1, :cond_0
- const/4 p1, 0x1
- return p1
- :cond_0
- add-int/lit8 v0, v0, 0x1
- goto :goto_0
- :cond_1
- const/4 p1, 0x0
- return p1
- .end method
- # virtual methods
- .method public configureSecureSocket(Ljavax/net/ssl/SSLSocket;)Lokhttp3/ConnectionSpec;
- .locals 4
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget v0, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->nextModeIndex:I
- iget-object v1, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->connectionSpecs:Ljava/util/List;
- invoke-interface {v1}, Ljava/util/List;->size()I
- move-result v1
- :cond_0
- if-ge v0, v1, :cond_1
- iget-object v2, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->connectionSpecs:Ljava/util/List;
- invoke-interface {v2, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
- move-result-object v2
- check-cast v2, Lokhttp3/ConnectionSpec;
- invoke-virtual {v2, p1}, Lokhttp3/ConnectionSpec;->isCompatible(Ljavax/net/ssl/SSLSocket;)Z
- move-result v3
- add-int/lit8 v0, v0, 0x1
- if-eqz v3, :cond_0
- iput v0, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->nextModeIndex:I
- goto :goto_0
- :cond_1
- const/4 v2, 0x0
- :goto_0
- if-eqz v2, :cond_2
- invoke-direct {p0, p1}, Lokhttp3/internal/connection/ConnectionSpecSelector;->isFallbackPossible(Ljavax/net/ssl/SSLSocket;)Z
- move-result v0
- iput-boolean v0, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->isFallbackPossible:Z
- sget-object v0, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
- iget-boolean v1, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->isFallback:Z
- invoke-virtual {v0, v2, p1, v1}, Lokhttp3/internal/Internal;->apply(Lokhttp3/ConnectionSpec;Ljavax/net/ssl/SSLSocket;Z)V
- return-object v2
- :cond_2
- new-instance v0, Ljava/net/UnknownServiceException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "Unable to find acceptable protocols. isFallback="
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget-boolean v2, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->isFallback:Z
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;
- const-string v2, ", modes="
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget-object v2, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->connectionSpecs:Ljava/util/List;
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
- const-string v2, ", supported protocols="
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {p1}, Ljavax/net/ssl/SSLSocket;->getEnabledProtocols()[Ljava/lang/String;
- move-result-object p1
- invoke-static {p1}, Ljava/util/Arrays;->toString([Ljava/lang/Object;)Ljava/lang/String;
- move-result-object p1
- 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/net/UnknownServiceException;-><init>(Ljava/lang/String;)V
- goto :goto_2
- :goto_1
- throw v0
- :goto_2
- goto :goto_1
- .end method
- .method public connectionFailed(Ljava/io/IOException;)Z
- .locals 4
- const/4 v0, 0x1
- iput-boolean v0, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->isFallback:Z
- iget-boolean v1, p0, Lokhttp3/internal/connection/ConnectionSpecSelector;->isFallbackPossible:Z
- const/4 v2, 0x0
- if-nez v1, :cond_0
- return v2
- :cond_0
- instance-of v1, p1, Ljava/net/ProtocolException;
- if-eqz v1, :cond_1
- return v2
- :cond_1
- instance-of v1, p1, Ljava/io/InterruptedIOException;
- if-eqz v1, :cond_2
- return v2
- :cond_2
- instance-of v1, p1, Ljavax/net/ssl/SSLHandshakeException;
- if-eqz v1, :cond_3
- invoke-virtual {p1}, Ljava/io/IOException;->getCause()Ljava/lang/Throwable;
- move-result-object v3
- instance-of v3, v3, Ljava/security/cert/CertificateException;
- if-eqz v3, :cond_3
- return v2
- :cond_3
- instance-of v3, p1, Ljavax/net/ssl/SSLPeerUnverifiedException;
- if-eqz v3, :cond_4
- return v2
- :cond_4
- if-nez v1, :cond_6
- instance-of p1, p1, Ljavax/net/ssl/SSLProtocolException;
- if-eqz p1, :cond_5
- goto :goto_0
- :cond_5
- const/4 v0, 0x0
- :cond_6
- :goto_0
- return v0
- .end method
|