Methods Summary |
---|
public synchronized java.net.Socket | createSocket(java.net.Socket socket, java.lang.String s, int i, boolean flag)
return adapteeFactory.createSocket(socket, s, i, flag);
|
public synchronized java.net.Socket | createSocket()
return adapteeFactory.createSocket();
|
public synchronized java.net.Socket | createSocket(java.net.InetAddress inetaddress, int i, java.net.InetAddress inetaddress1, int j)
return adapteeFactory.createSocket(inetaddress, i, inetaddress1, j);
|
public synchronized java.net.Socket | createSocket(java.net.InetAddress inetaddress, int i)
return adapteeFactory.createSocket(inetaddress, i);
|
public synchronized java.net.Socket | createSocket(java.lang.String s, int i, java.net.InetAddress inetaddress, int j)
return adapteeFactory.createSocket(s, i, inetaddress, j);
|
public synchronized java.net.Socket | createSocket(java.lang.String s, int i)
return adapteeFactory.createSocket(s, i);
|
public synchronized java.lang.String[] | getDefaultCipherSuites()
return adapteeFactory.getDefaultCipherSuites();
|
public synchronized javax.net.ssl.KeyManager[] | getKeyManagers()
return (KeyManager[])keyManagers.clone();
|
public synchronized java.security.SecureRandom | getSecureRandom()
return secureRandom;
|
public synchronized java.lang.String[] | getSupportedCipherSuites()
return adapteeFactory.getSupportedCipherSuites();
|
public synchronized javax.net.ssl.TrustManager[] | getTrustManagers()
return trustManagers;
|
public synchronized java.lang.String[] | getTrustedHosts()
return (String[])trustedHosts.clone();
|
public synchronized boolean | isServerTrusted(java.lang.String server, javax.net.ssl.SSLSocket sslSocket)After a successful conection to the server, this method is
called to ensure that the server should be trusted.
//System.out.println("DEBUG: isServerTrusted host " + server);
// If "trustAllHosts" is set to true, we return true
if (trustAllHosts)
return true;
// If the socket host is contained in the "trustedHosts" array,
// we return true
if (trustedHosts != null)
return Arrays.asList(trustedHosts).contains(server); // ignore case?
// If we get here, trust of the server was verified by the trust manager
return true;
|
public synchronized boolean | isTrustAllHosts()
return trustAllHosts;
|
private synchronized void | newAdapteeFactory()Gets an SSLSocketFactory based on the given (or default)
KeyManager array, TrustManager array and SecureRandom and
sets it to the instance var adapteeFactory.
sslcontext.init(keyManagers, trustManagers, secureRandom);
// Get SocketFactory and save it in our instance var
adapteeFactory = (SSLSocketFactory)sslcontext.getSocketFactory();
|
public synchronized void | setKeyManagers(javax.net.ssl.KeyManager[] keyManagers)
this.keyManagers = (KeyManager[])keyManagers.clone();
newAdapteeFactory();
|
public synchronized void | setSecureRandom(java.security.SecureRandom secureRandom)
this.secureRandom = secureRandom;
newAdapteeFactory();
|
public synchronized void | setTrustAllHosts(boolean trustAllHosts)
this.trustAllHosts = trustAllHosts;
|
public synchronized void | setTrustManagers(javax.net.ssl.TrustManager[] trustManagers)
this.trustManagers = trustManagers;
newAdapteeFactory();
|
public synchronized void | setTrustedHosts(java.lang.String[] trustedHosts)
this.trustedHosts = (String[])trustedHosts.clone();
|