@@ -0,0 +1,2318 @@
+package tw.idv.laiis.ezretrofit;%0A%0Aimport okhttp3.ConnectionSpec;%0A%0Aimport javax.net.ssl.SSLSocket;%0Aimport javax.net.ssl.SSLSocketFactory;%0Aimport java.io.IOException;%0Aimport java.net.InetAddress;%0Aimport java.net.Socket;%0Aimport java.net.UnknownHostException;%0A%0A/**%0A * Enables TLS v1.2 when creating SSLSockets.%0A * %3Cp/%3E%0A * For some reason, android supports TLS v1.2 from API 16, but enables it by%0A * default only from API 20.%0A *%0A * @link https://developer.android.com/reference/javax/net/ssl/SSLSocket.html%0A * @see SSLSocketFactory%0A */%0Apublic class Tls12SocketFactory extends SSLSocketFactory %7B%0A    private static final String%5B%5D ALL_TLSs = %7B%22SSLv3%22, %22TLSv1%22, %22TLSv1.1%22, %22TLSv1.2%22, %22TLSv1.2%22%7D;%0A%0A    final SSLSocketFactory delegate;%0A%0A    public Tls12SocketFactory(SSLSocketFactory base) %7B%0A        this.delegate = base;%0A    %7D%0A%0A    @Override%0A    public String%5B%5D getDefaultCipherSuites() %7B%0A        return delegate.getDefaultCipherSuites();%0A    %7D%0A%0A    @Override%0A    public String%5B%5D getSupportedCipherSuites() %7B%0A        return delegate.getSupportedCipherSuites();%0A    %7D%0A%0A    @Override%0A    public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException %7B%0A        return patch(delegate.createSocket(s, host, port, autoClose));%0A    %7D%0A%0A    @Override%0A    public Socket createSocket(String host, int port) throws IOException, UnknownHostException %7B%0A        return patch(delegate.createSocket(host, port));%0A    %7D%0A%0A    @Override%0A    public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException, UnknownHostException %7B%0A        return patch(delegate.createSocket(host, port, localHost, localPort));%0A    %7D%0A%0A    @Override%0A    public Socket createSocket(InetAddress host, int port) throws IOException %7B%0A        return patch(delegate.createSocket(host, port));%0A    %7D%0A%0A    @Override%0A    public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException %7B%0A        return patch(delegate.createSocket(address, port, localAddress, localPort));%0A    %7D%0A%0A    private Socket patch(Socket s) %7B%0A        if (s instanceof SSLSocket) %7B%0A            ((SSLSocket) s).setEnabledProtocols(ALL_TLSs);%0A            ((SSLSocket) s).setEnabledCipherSuites(((SSLSocket) s).getSupportedCipherSuites());%0A        %7D%0A        return s;%0A    %7D%0A%7D

add Tls12SocketFactory