` public class HttpsUtils { public static class SSLParams { public SSLSocketFactory sSLSocketFactory; public X509TrustManager trustManager; } public static SSLParams getSslSocketFactory() { return getSslSocketFactoryBase(null, null, null...
privatevaleventListener: EventListener = client.eventListenerFactory.create(call) privatevaltimeout =object: AsyncTimeout() { overridefuntimedOut(){ cancel() } }.apply { timeout(client.callTimeoutMillis.toLong(), MILLISECONDS) } //...无关代码略...
Non-fatal Exception: java.net.SocketTimeoutException: SSL handshake timed out at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(NativeCrypto.java) at com.google.android.gms.org.conscrypt.NativeSsl.doHandshake(NativeSsl.java:6) at com.google.android.gms.org.conscrypt.ConscryptFile...
sslSocket.startHandshake();// block for session establishmentSSLSession sslSocketSession = sslSocket.getSession(); Handshake unverifiedHandshake = Handshake.get(sslSocketSession);// Verify that the socket's certificates are acceptable for the target host.if(!address.hostnameVerifier().verify(address.ur...
socket.setSoTimeout(readTimeout); } }catch(SocketTimeoutException ignored) {// Read timed out; socket is good.}catch(IOException e) {returnfalse;// Couldn't read; socket is closed.} }returntrue; } 首先要可以进行IO,此外对于HTTP/2,只要http2Connection存在即可。如我们前面在ConnectInterceptor中...
* {@link #rawSocket} itself if this connection does not use SSL. */privateSocket socket;//应用层socket//握手privateHandshake handshake;//协议privateProtocol protocol;// http2的链接privateHttp2Connection http2Connection;//通过source和sink,大家可以猜到是与服务器交互的输入输出流privateBufferedSource so...
Save the handshake and the ALPN protocol.37String maybeProtocol =connectionSpec.supportsTlsExtensions()38?Platform.get().getSelectedProtocol(sslSocket)39:null;40socket =sslSocket;41source =Okio.buffer(Okio.source(socket));42sink =Okio.buffer(Okio.sink(socket));43handshake =unverifiedHandshake;44proto...
readTimeout = socket.getSoTimeout(); try { socket.setSoTimeout(1); if (source.exhausted()) { return false; // Stream is exhausted; socket is closed. } return true; } finally { socket.setSoTimeout(readTimeout); } } catch (SocketTimeoutException ignored) { // Read timed out; ...
timeout = new AsyncTimeout() { @Override protected void timedOut() { cancel(); } }; this.timeout.timeout(client.callTimeoutMillis(), MILLISECONDS); } retryAndFollowUpInterceptor重定向和重试拦截器是一个拦截器对象,这也是OkHttp中一个重要的概念,而OkHttp就是通过执行拦截器链中的各个拦截器完成的...
主要看下ConnectInterceptor()方法,里面代码已经很简单了,受限了通过streamAllocation的newStream方法获取一个...