Example usage for android.net SSLCertificateSocketFactory SSLCertificateSocketFactory

List of usage examples for android.net SSLCertificateSocketFactory SSLCertificateSocketFactory

Introduction

In this page you can find the example usage for android.net SSLCertificateSocketFactory SSLCertificateSocketFactory.

Prototype

@UnsupportedAppUsage
    private SSLCertificateSocketFactory(int handshakeTimeoutMillis, SSLSessionCache cache, boolean secure) 

Source Link

Usage

From source file:android.net.SSLCertificateSocketFactory.java

/**
 * Returns a new socket factory instance with an optional handshake timeout.
 *
 * @param handshakeTimeoutMillis to use for SSL connection handshake, or 0
 *         for none.  The socket timeout is reset to 0 after the handshake.
 * @return a new SSLSocketFactory with the specified parameters
 *///from   w w w  .  j a va 2 s .c  o m
public static SocketFactory getDefault(int handshakeTimeoutMillis) {
    return new SSLCertificateSocketFactory(handshakeTimeoutMillis, null, true);
}

From source file:android.net.SSLCertificateSocketFactory.java

/**
 * Returns a new socket factory instance with an optional handshake timeout
 * and SSL session cache.//from  w w w.  j av a2s  .c  o m
 *
 * @param handshakeTimeoutMillis to use for SSL connection handshake, or 0
 *         for none.  The socket timeout is reset to 0 after the handshake.
 * @param cache The {@link SSLSessionCache} to use, or null for no cache.
 * @return a new SSLSocketFactory with the specified parameters
 */
public static SSLSocketFactory getDefault(int handshakeTimeoutMillis, SSLSessionCache cache) {
    return new SSLCertificateSocketFactory(handshakeTimeoutMillis, cache, true);
}

From source file:android.net.SSLCertificateSocketFactory.java

/**
 * Returns a new instance of a socket factory with all SSL security checks
 * disabled, using an optional handshake timeout and SSL session cache.
 *
 * <p class="caution"><b>Warning:</b> Sockets created using this factory
 * are vulnerable to man-in-the-middle attacks!</p>
 *
 * @param handshakeTimeoutMillis to use for SSL connection handshake, or 0
 *         for none.  The socket timeout is reset to 0 after the handshake.
 * @param cache The {@link SSLSessionCache} to use, or null for no cache.
 * @return an insecure SSLSocketFactory with the specified parameters
 *///from   w  w w .ja va  2  s  .c  o  m
public static SSLSocketFactory getInsecure(int handshakeTimeoutMillis, SSLSessionCache cache) {
    return new SSLCertificateSocketFactory(handshakeTimeoutMillis, cache, false);
}

From source file:android.net.SSLCertificateSocketFactory.java

/**
 * Returns a socket factory (also named SSLSocketFactory, but in a different
 * namespace) for use with the Apache HTTP stack.
 *
 * @param handshakeTimeoutMillis to use for SSL connection handshake, or 0
 *         for none.  The socket timeout is reset to 0 after the handshake.
 * @param cache The {@link SSLSessionCache} to use, or null for no cache.
 * @return a new SocketFactory with the specified parameters
 *//* ww w  .j av  a  2  s. c om*/
public static org.apache.http.conn.ssl.SSLSocketFactory getHttpSocketFactory(int handshakeTimeoutMillis,
        SSLSessionCache cache) {
    return new org.apache.http.conn.ssl.SSLSocketFactory(
            new SSLCertificateSocketFactory(handshakeTimeoutMillis, cache, true));
}