Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4e2e75bdee
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (27 sloc) 0.956 kb
package co.freeside.betamax.ssl
import java.security.*
import javax.net.ssl.*
import org.apache.http.conn.ssl.SSLSocketFactory
class DummySSLSocketFactory extends SSLSocketFactory {
private final SSLContext sslContext = SSLContext.getInstance('TLS')
private final javax.net.ssl.SSLSocketFactory factory
static DummySSLSocketFactory getInstance() {
def trustStore = KeyStore.getInstance(KeyStore.defaultType)
trustStore.load(null, null)
new DummySSLSocketFactory(trustStore)
}
DummySSLSocketFactory(KeyStore trustStore) {
super(trustStore)
sslContext.init(null, [new DummyX509TrustManager()] as TrustManager[], new SecureRandom())
factory = sslContext.socketFactory
setHostnameVerifier(ALLOW_ALL_HOSTNAME_VERIFIER)
}
@Override
Socket createSocket(Socket socket, String host, int port, boolean autoClose) {
factory.createSocket(socket, host, port, autoClose)
}
@Override
Socket createSocket() {
factory.createSocket()
}
}
Jump to Line
Something went wrong with that request. Please try again.