// Path: src/android/com/silkimen/http/TLSSocketFactory.java
// public class TLSSocketFactory extends SSLSocketFactory {
// 
//   private SSLSocketFactory delegate;
//   private List<String> blacklistedProtocols;
// 
//   public TLSSocketFactory(SSLContext context, String[] blacklistedProtocols) {
//     this.delegate = context.getSocketFactory();
//     this.blacklistedProtocols = new ArrayList();
// 
//     for (int i = 0; i < blacklistedProtocols.length; ++i) {
//       this.blacklistedProtocols.add(blacklistedProtocols[i].trim());
//     }
//   }
// 
//   @Override
//   public String[] getDefaultCipherSuites() {
//     return delegate.getDefaultCipherSuites();
//   }
// 
//   @Override
//   public String[] getSupportedCipherSuites() {
//     return delegate.getSupportedCipherSuites();
//   }
// 
//   @Override
//   public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException {
//     return enableTLSOnSocket(delegate.createSocket(socket, host, port, autoClose));
//   }
// 
//   @Override
//   public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
//     return enableTLSOnSocket(delegate.createSocket(host, port));
//   }
// 
//   @Override
//   public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
//       throws IOException, UnknownHostException {
//     return enableTLSOnSocket(delegate.createSocket(host, port, localHost, localPort));
//   }
// 
//   @Override
//   public Socket createSocket(InetAddress host, int port) throws IOException {
//     return enableTLSOnSocket(delegate.createSocket(host, port));
//   }
// 
//   @Override
//   public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort)
//       throws IOException {
//     return enableTLSOnSocket(delegate.createSocket(address, port, localAddress, localPort));
//   }
// 
//   private Socket enableTLSOnSocket(Socket socket) {
//     if (socket == null || !(socket instanceof SSLSocket)) {
//       return socket;
//     }
// 
//     String[] supported = ((SSLSocket) socket).getSupportedProtocols();
//     List<String> filtered = new ArrayList();
// 
//     for (int i = 0; i < supported.length; ++i) {
//       if (!this.blacklistedProtocols.contains(supported[i])) {
//         filtered.add(supported[i]);
//       }
//     }
// 
//     ((SSLSocket) socket).setEnabledProtocols(filtered.toArray(new String[0]));
// 
//     return socket;
//   }
// }


import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import com.silkimen.http.TLSSocketFactory;
  }

  public void setKeyManagers(KeyManager[] keyManagers) {
    this.keyManagers = keyManagers;
    this.socketFactory = null;
  }

  public void setTrustManagers(TrustManager[] trustManagers) {
    this.trustManagers = trustManagers;
    this.socketFactory = null;
  }

  public void setBlacklistedProtocols(String[] protocols) {
    this.blacklistedProtocols = protocols;
    this.socketFactory = null;
  }

  public HostnameVerifier getHostnameVerifier() {
    return this.hostnameVerifier;
  }

  public SSLSocketFactory getTLSSocketFactory() throws IOException {
    if (this.socketFactory != null) {
      return this.socketFactory;
    }

    try {
      SSLContext context = SSLContext.getInstance("TLS");

      context.init(this.keyManagers, this.trustManagers, new SecureRandom());
// Path: src/android/com/silkimen/http/TLSSocketFactory.java
// public class TLSSocketFactory extends SSLSocketFactory {
// 
//   private SSLSocketFactory delegate;
//   private List<String> blacklistedProtocols;
// 
//   public TLSSocketFactory(SSLContext context, String[] blacklistedProtocols) {
//     this.delegate = context.getSocketFactory();
//     this.blacklistedProtocols = new ArrayList();
// 
//     for (int i = 0; i < blacklistedProtocols.length; ++i) {
//       this.blacklistedProtocols.add(blacklistedProtocols[i].trim());
//     }
//   }
// 
//   @Override
//   public String[] getDefaultCipherSuites() {
//     return delegate.getDefaultCipherSuites();
//   }
// 
//   @Override
//   public String[] getSupportedCipherSuites() {
//     return delegate.getSupportedCipherSuites();
//   }
// 
//   @Override
//   public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException {
//     return enableTLSOnSocket(delegate.createSocket(socket, host, port, autoClose));
//   }
// 
//   @Override
//   public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
//     return enableTLSOnSocket(delegate.createSocket(host, port));
//   }
// 
//   @Override
//   public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
//       throws IOException, UnknownHostException {
//     return enableTLSOnSocket(delegate.createSocket(host, port, localHost, localPort));
//   }
// 
//   @Override
//   public Socket createSocket(InetAddress host, int port) throws IOException {
//     return enableTLSOnSocket(delegate.createSocket(host, port));
//   }
// 
//   @Override
//   public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort)
//       throws IOException {
//     return enableTLSOnSocket(delegate.createSocket(address, port, localAddress, localPort));
//   }
// 
//   private Socket enableTLSOnSocket(Socket socket) {
//     if (socket == null || !(socket instanceof SSLSocket)) {
//       return socket;
//     }
// 
//     String[] supported = ((SSLSocket) socket).getSupportedProtocols();
//     List<String> filtered = new ArrayList();
// 
//     for (int i = 0; i < supported.length; ++i) {
//       if (!this.blacklistedProtocols.contains(supported[i])) {
//         filtered.add(supported[i]);
//       }
//     }
// 
//     ((SSLSocket) socket).setEnabledProtocols(filtered.toArray(new String[0]));
// 
//     return socket;
//   }
// }


// Path: src/android/com/silkimen/http/TLSConfiguration.java
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import com.silkimen.http.TLSSocketFactory;

  }

  public void setKeyManagers(KeyManager[] keyManagers) {
    this.keyManagers = keyManagers;
    this.socketFactory = null;
  }

  public void setTrustManagers(TrustManager[] trustManagers) {
    this.trustManagers = trustManagers;
    this.socketFactory = null;
  }

  public void setBlacklistedProtocols(String[] protocols) {
    this.blacklistedProtocols = protocols;
    this.socketFactory = null;
  }

  public HostnameVerifier getHostnameVerifier() {
    return this.hostnameVerifier;
  }

  public SSLSocketFactory getTLSSocketFactory() throws IOException {
    if (this.socketFactory != null) {
      return this.socketFactory;
    }

    try {
      SSLContext context = SSLContext.getInstance("TLS");

      context.init(this.keyManagers, this.trustManagers, new SecureRandom());
      this.socketFactory = new TLSSocketFactory(context, this.blacklistedProtocols);