MD5 校验值:13e9f681f5bed77188ac69741746def0
nk2.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package libs; import java.io.IOException; import java.io.InterruptedIOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.ConnectException; import java.net.InetSocketAddress; import java.net.ProtocolException; import java.net.Proxy; import java.net.Socket; import java.net.SocketTimeoutException; import java.net.UnknownServiceException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.SSLException; import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; public final class nk2 extends a21 { public final ok2 b; public final vo2 c; public Socket d; public Socket e; public pz0 f; public sf2 g; public f21 h; public lk2 i; public kk2 j; public boolean k; public int l; public int m; public int n; public int o = 1; public final ArrayList p = new ArrayList(); public long q = Long.MAX_VALUE; public nk2(ok2 ok2Var, vo2 vo2Var) { this.b = ok2Var; this.c = vo2Var; } @Override public final void a(f21 f21Var) { synchronized (this.b) { this.o = f21Var.o(); } } @Override public final void b(m21 m21Var) { m21Var.c(5, null); } public final void c(int i, int i2, int i3, boolean z, l63 l63Var) { boolean z2; if (this.g == null) { e7 e7Var = this.c.a; List list = e7Var.f; h10 h10Var = new h10(list); if (e7Var.i == null) { if (list.contains(g10.f)) { String str = this.c.a.a.d; x8.g.getClass(); } else { throw new wo2(new UnknownServiceException("CLEARTEXT communication not enabled for client")); } } else if (e7Var.e.contains(sf2.H2_PRIOR_KNOWLEDGE)) { throw new wo2(new UnknownServiceException("H2_PRIOR_KNOWLEDGE cannot be used with HTTPS")); } wo2 wo2Var = null; do { try { if (this.c.a()) { e(i, i2, i3, l63Var); if (this.d == null) { if (!this.c.a() && this.d == null) { throw new wo2(new ProtocolException("Too many tunnel connections attempted: 21")); } if (this.h == null) { synchronized (this.b) { this.o = this.h.o(); } return; } return; } } else { d(i, i2, l63Var); } f(h10Var, l63Var); InetSocketAddress inetSocketAddress = this.c.c; l63Var.getClass(); if (!this.c.a()) { } if (this.h == null) { } } catch (IOException e) { yo3.d(this.e); yo3.d(this.d); this.e = null; this.d = null; this.i = null; this.j = null; this.f = null; this.g = null; this.h = null; InetSocketAddress inetSocketAddress2 = this.c.c; l63Var.getClass(); if (wo2Var == null) { wo2Var = new wo2(e); } else { IOException iOException = wo2Var.X; Method method = yo3.g; if (method != null) { try { method.invoke(iOException, e); } catch (IllegalAccessException | InvocationTargetException unused) { } } wo2Var.Y = e; } if (z) { h10Var.d = true; if (!h10Var.c || (e instanceof ProtocolException) || (e instanceof InterruptedIOException) || (((e instanceof SSLHandshakeException) && (e.getCause() instanceof CertificateException)) || (e instanceof SSLPeerUnverifiedException))) { z2 = false; } else { z2 = e instanceof SSLException; } } else { throw wo2Var; } } } while (z2); throw wo2Var; } throw new IllegalStateException("already connected"); } public final void d(int i, int i2, l63 l63Var) { Socket createSocket; vo2 vo2Var = this.c; Proxy proxy = vo2Var.b; InetSocketAddress inetSocketAddress = vo2Var.c; if (proxy.type() != Proxy.Type.DIRECT && proxy.type() != Proxy.Type.HTTP) { createSocket = new Socket(proxy); } else { createSocket = vo2Var.a.c.createSocket(); } this.d = createSocket; l63Var.getClass(); this.d.setSoTimeout(i2); try { x8 x8Var = x8.g; Socket socket = this.d; x8Var.getClass(); x8.b(socket, inetSocketAddress, i); try { this.i = new lk2(c32.b(this.d)); this.j = new kk2(c32.a(this.d)); } catch (NullPointerException e) { if (!"throw with null exception".equals(e.getMessage())) { } else { throw z90.j(e); } } } catch (ConnectException e2) { ConnectException connectException = new ConnectException("Failed to connect to " + inetSocketAddress); connectException.initCause(e2); throw connectException; } } public final void e(int i, int i2, int i3, l63 l63Var) { e eVar = new e(5); vo2 vo2Var = this.c; z21 z21Var = vo2Var.a.a; if (z21Var != null) { eVar.b = z21Var; eVar.k("CONNECT", null); e7 e7Var = vo2Var.a; ((c3) eVar.d).R("Host", yo3.i(e7Var.a, true)); ((c3) eVar.d).R("Proxy-Connection", "Keep-Alive"); ((c3) eVar.d).R("User-Agent", "okhttp/${project.version}"); ym2 e = eVar.e(); wn2 wn2Var = new wn2(); wn2Var.a = e; wn2Var.b = sf2.HTTP_1_1; wn2Var.c = 407; wn2Var.d = "Preemptive Authenticate"; wn2Var.g = yo3.c; wn2Var.k = -1L; wn2Var.l = -1L; wn2Var.f.R("Proxy-Authenticate", "OkHttp-Preemptive"); wn2Var.a(); e7Var.d.getClass(); d(i, i2, l63Var); String str = "CONNECT " + yo3.i(e.a, true) + " HTTP/1.1"; lk2 lk2Var = this.i; s11 s11Var = new s11(null, null, lk2Var, this.j); ck3 b = lk2Var.Y.b(); long j = i2; TimeUnit timeUnit = TimeUnit.MILLISECONDS; b.g(j, timeUnit); this.j.Y.b().g(i3, timeUnit); s11Var.C(e.c, str); s11Var.d(); wn2 g = s11Var.g(false); g.a = e; yn2 a = g.a(); long a2 = p21.a(a); if (a2 != -1) { p11 v = s11Var.v(a2); yo3.p(v, Integer.MAX_VALUE, timeUnit); v.close(); } int i4 = a.Z; if (i4 != 200) { if (i4 == 407) { e7Var.d.getClass(); throw new IOException("Failed to authenticate with proxy"); } throw new IOException(il1.g(i4, "Unexpected response code for CONNECT: ")); } if (this.i.X.p() && this.j.X.p()) { return; } else { throw new IOException("TLS tunnel buffered too many bytes!"); } } throw new NullPointerException("url == null"); } public final void f(h10 h10Var, l63 l63Var) { boolean z; SSLSocket sSLSocket; kd kdVar; byte[] bArr; vo2 vo2Var = this.c; e7 e7Var = vo2Var.a; SSLSocketFactory sSLSocketFactory = e7Var.i; sf2 sf2Var = sf2.HTTP_1_1; if (sSLSocketFactory == null) { sf2 sf2Var2 = sf2.H2_PRIOR_KNOWLEDGE; if (e7Var.e.contains(sf2Var2)) { this.e = this.d; this.g = sf2Var2; j(); return; } else { this.e = this.d; this.g = sf2Var; return; } } l63Var.getClass(); e7 e7Var2 = vo2Var.a; SSLSocketFactory sSLSocketFactory2 = e7Var2.i; z21 z21Var = e7Var2.a; SSLSocket sSLSocket2 = null; r2 = null; r2 = null; r2 = null; String str = null; try { try { z = true; sSLSocket = (SSLSocket) sSLSocketFactory2.createSocket(this.d, z21Var.d, z21Var.e, true); } catch (AssertionError e) { e = e; } } catch (Throwable th) { th = th; } try { g10 a = h10Var.a(sSLSocket); String str2 = z21Var.d; boolean z2 = a.b; if (z2) { x8.g.a(sSLSocket, str2, e7Var2.e); } sSLSocket.startHandshake(); SSLSession session = sSLSocket.getSession(); pz0 a2 = pz0.a(session); boolean verify = e7Var2.j.verify(str2, session); List list = a2.c; if (!verify) { if (!list.isEmpty()) { X509Certificate x509Certificate = (X509Certificate) list.get(0); throw new SSLPeerUnverifiedException("Hostname " + str2 + " not verified:\n certificate: " + ou.b(x509Certificate) + "\n DN: " + x509Certificate.getSubjectDN().getName() + "\n subjectAltNames: " + y22.a(x509Certificate)); } throw new SSLPeerUnverifiedException("Hostname " + str2 + " not verified (no certificates)"); } e7Var2.k.a(str2, list); if (z2 && (kdVar = x8.g.d) != null) { if (kdVar.e(sSLSocket.getClass()) == null) { z = false; } if (z && (bArr = (byte[]) kdVar.h(sSLSocket, new Object[0])) != null) { str = ui3.q(bArr, bd3.c); } } this.e = sSLSocket; this.i = new lk2(c32.b(sSLSocket)); this.j = new kk2(c32.a(this.e)); this.f = a2; if (str != null) { sf2Var = sf2.a(str); } this.g = sf2Var; x8.g.getClass(); if (this.g == sf2.HTTP_2) { j(); } } catch (AssertionError e2) { e = e2; if (yo3.m(e)) { throw z90.j(e); } throw e; } catch (Throwable th2) { th = th2; sSLSocket2 = sSLSocket; if (sSLSocket2 != null) { x8.g.getClass(); } yo3.d(sSLSocket2); throw th; } } public final boolean g(boolean z) { if (this.e.isClosed() || this.e.isInputShutdown() || this.e.isOutputShutdown()) { return false; } f21 f21Var = this.h; if (f21Var != null) { long nanoTime = System.nanoTime(); synchronized (f21Var) { if (f21Var.P1) { return false; } if (f21Var.V1 < f21Var.U1) { if (nanoTime >= f21Var.W1) { return false; } } return true; } } if (z) { try { int soTimeout = this.e.getSoTimeout(); try { this.e.setSoTimeout(1); if (this.i.c()) { return false; } return true; } finally { this.e.setSoTimeout(soTimeout); } } catch (SocketTimeoutException unused) { } catch (IOException unused2) { return false; } } return true; } public final gn0 h(a32 a32Var, pk2 pk2Var) { if (this.h != null) { return new g21(a32Var, this, pk2Var, this.h); } Socket socket = this.e; int i = pk2Var.h; socket.setSoTimeout(i); TimeUnit timeUnit = TimeUnit.MILLISECONDS; this.i.Y.b().g(i, timeUnit); this.j.Y.b().g(pk2Var.i, timeUnit); return new s11(a32Var, this, this.i, this.j); } public final void i() { if (!Thread.holdsLock(this.b)) { synchronized (this.b) { this.k = true; } return; } throw new AssertionError(); } public final void j() { this.e.setSoTimeout(0); e eVar = new e(4); Socket socket = this.e; String str = this.c.a.a.d; lk2 lk2Var = this.i; kk2 kk2Var = this.j; eVar.b = socket; eVar.c = str; eVar.d = lk2Var; eVar.e = kk2Var; eVar.f = this; f21 f21Var = new f21(eVar); this.h = f21Var; n21 n21Var = f21Var.c2; synchronized (n21Var) { try { if (!n21Var.M1) { Logger logger = n21.O1; if (logger.isLoggable(Level.FINE)) { String i = t11.a.i(); byte[] bArr = yo3.a; Locale locale = Locale.US; logger.fine(">> CONNECTION " + i); } n21Var.X.write((byte[]) t11.a.X.clone()); n21Var.X.flush(); } else { throw new IOException("closed"); } } catch (Throwable th) { throw th; } } f21Var.c2.t(f21Var.Z1); if (f21Var.Z1.a() != 65535) { f21Var.c2.u(r0 - 65535, 0); } new Thread(f21Var.d2).start(); } public final boolean k(z21 z21Var) { int i = z21Var.e; z21 z21Var2 = this.c.a.a; if (i != z21Var2.e) { return false; } String str = z21Var.d; if (str.equals(z21Var2.d)) { return true; } pz0 pz0Var = this.f; if (pz0Var == null || !y22.c(str, (X509Certificate) pz0Var.c.get(0))) { return false; } return true; } public final String toString() { Object obj; StringBuilder sb = new StringBuilder("Connection{"); vo2 vo2Var = this.c; sb.append(vo2Var.a.a.d); sb.append(":"); sb.append(vo2Var.a.a.e); sb.append(", proxy="); sb.append(vo2Var.b); sb.append(" hostAddress="); sb.append(vo2Var.c); sb.append(" cipherSuite="); pz0 pz0Var = this.f; if (pz0Var != null) { obj = pz0Var.b; } else { obj = "none"; } sb.append(obj); sb.append(" protocol="); sb.append(this.g); sb.append('}'); return sb.toString(); } }