what-the-bank/sources/com/facetec/sdk/kt.java

205 lines
5.7 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.facetec.sdk;
import com.airbnb.deeplinkdispatch.UrlTreeKt;
import com.facetec.sdk.lw;
import java.io.IOException;
import java.lang.ref.Reference;
import java.net.ConnectException;
import java.net.Proxy;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import javax.net.ssl.SSLPeerUnverifiedException;
/* loaded from: classes.dex */
public final class kt extends lw.a {
Socket a;
jw b;
final jp c;
Socket d;
final kj e;
lw f;
mr g;
kd h;
public boolean i;
mv j;
public int m;
public int n = 1;
/* renamed from: o, reason: collision with root package name */
public final List<Reference<ky>> f6451o = new ArrayList();
public long k = Long.MAX_VALUE;
public kt(jp jpVar, kj kjVar) {
this.c = jpVar;
this.e = kjVar;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void d(int i, int i2) throws IOException {
Socket createSocket;
Proxy b = this.e.b();
jj e = this.e.e();
if (b.type() == Proxy.Type.DIRECT || b.type() == Proxy.Type.HTTP) {
createSocket = e.e.createSocket();
} else {
createSocket = new Socket(b);
}
this.d = createSocket;
this.e.c();
this.d.setSoTimeout(i2);
try {
mi.c().c(this.d, this.e.c(), i);
try {
this.g = nb.c(nb.e(this.d));
this.j = nb.e(nb.a(this.d));
} catch (NullPointerException e2) {
if ("throw with null exception".equals(e2.getMessage())) {
throw new IOException(e2);
}
}
} catch (ConnectException e3) {
StringBuilder sb = new StringBuilder("Failed to connect to ");
sb.append(this.e.c());
ConnectException connectException = new ConnectException(sb.toString());
connectException.initCause(e3);
throw connectException;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void d(int i) throws IOException {
this.a.setSoTimeout(0);
lw.c cVar = new lw.c();
Socket socket = this.a;
String i2 = this.e.e().b().i();
mr mrVar = this.g;
mv mvVar = this.j;
cVar.e = socket;
cVar.d = i2;
cVar.a = mrVar;
cVar.b = mvVar;
cVar.c = this;
cVar.j = i;
lw lwVar = new lw(cVar);
this.f = lwVar;
lwVar.f6456o.e();
lwVar.f6456o.c(lwVar.m);
if (lwVar.m.c() != 65535) {
lwVar.f6456o.c(0, r0 - 65535);
}
new Thread(lwVar.l).start();
}
public final boolean c(jj jjVar, kj kjVar) {
if (this.f6451o.size() >= this.n || this.i || !kn.a.a(this.e.e(), jjVar)) {
return false;
}
if (jjVar.b().i().equals(c().e().b().i())) {
return true;
}
if (this.f == null || kjVar == null || kjVar.b().type() != Proxy.Type.DIRECT || this.e.b().type() != Proxy.Type.DIRECT || !this.e.c().equals(kjVar.c()) || kjVar.e().j() != mn.d || !d(jjVar.b())) {
return false;
}
try {
jjVar.f().c(jjVar.b().i(), e().d());
return true;
} catch (SSLPeerUnverifiedException unused) {
return false;
}
}
public final boolean d(kc kcVar) {
if (kcVar.j() != this.e.e().b().j()) {
return false;
}
if (kcVar.i().equals(this.e.e().b().i())) {
return true;
}
if (this.b != null) {
mn mnVar = mn.d;
if (mn.a(kcVar.i(), (X509Certificate) this.b.d().get(0))) {
return true;
}
}
return false;
}
public final void a() {
km.b(this.d);
}
public final boolean e(boolean z) {
if (this.a.isClosed() || this.a.isInputShutdown() || this.a.isOutputShutdown()) {
return false;
}
lw lwVar = this.f;
if (lwVar != null) {
return !lwVar.a();
}
if (z) {
try {
int soTimeout = this.a.getSoTimeout();
try {
this.a.setSoTimeout(1);
return !this.g.a();
} finally {
this.a.setSoTimeout(soTimeout);
}
} catch (SocketTimeoutException unused) {
} catch (IOException unused2) {
return false;
}
}
return true;
}
@Override // com.facetec.sdk.lw.a
public final void e(ls lsVar) throws IOException {
lsVar.e(lo.REFUSED_STREAM);
}
@Override // com.facetec.sdk.lw.a
public final void c(lw lwVar) {
synchronized (this.c) {
this.n = lwVar.d();
}
}
public final String toString() {
StringBuilder sb = new StringBuilder("Connection{");
sb.append(this.e.e().b().i());
sb.append(":");
sb.append(this.e.e().b().j());
sb.append(", proxy=");
sb.append(this.e.b());
sb.append(" hostAddress=");
sb.append(this.e.c());
sb.append(" cipherSuite=");
jw jwVar = this.b;
sb.append(jwVar != null ? jwVar.d : "none");
sb.append(" protocol=");
sb.append(this.h);
sb.append(UrlTreeKt.componentParamSuffixChar);
return sb.toString();
}
public final jw e() {
return this.b;
}
public final Socket d() {
return this.a;
}
public final kj c() {
return this.e;
}
public final boolean b() {
return this.f != null;
}
}