Fix bug with new clash for android

This commit is contained in:
tehcneko committed 2021-04-10 10:11:43 +08:00
1 parent f2168a2f44
commit 9a9ce47a5f
2 files changed
+5 -7

No files matched your search

@@ -25,15 +25,14 @@ public class EhSSLSocketFactory extends SSLSocketFactory {
@Override
public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException {
SSLSocketFactory defaultFactory = (SSLSocketFactory) getDefault();
if (!Settings.getDF()) {
return ((SSLSocketFactory) getDefault()).createSocket(s, host, port, autoClose);
return defaultFactory.createSocket(s, host, port, autoClose);
}
InetAddress address = s.getInetAddress();
// okhttp 4.9 don't like this
//if (autoClose) s.close();
SSLSocket socket = (SSLSocket) getDefault().createSocket(address, port);
String address = s.getInetAddress().getHostAddress();
SSLSocket socket = (SSLSocket) defaultFactory.createSocket(s, address, port, autoClose);
SSLSession sslSession = socket.getSession();
Log.d("EhSSLSocketFactory", "Host: " + host + " Address: " + address.getHostAddress() + " Protocol:" + sslSession.getProtocol() + " CipherSuite:" + sslSession.getCipherSuite());
Log.d("EhSSLSocketFactory", "Host: " + host + " Address: " + address + " Protocol:" + sslSession.getProtocol() + " CipherSuite:" + sslSession.getCipherSuite());
socket.setEnabledProtocols(socket.getSupportedProtocols());
return socket;
}