org.glite.security.trustmanager
Class TimeoutSSLSocketFactory

java.lang.Object
  extended by javax.net.SocketFactory
      extended by javax.net.ssl.SSLSocketFactory
          extended by org.glite.security.trustmanager.TimeoutSSLSocketFactory

public class TimeoutSSLSocketFactory
extends javax.net.ssl.SSLSocketFactory

A wrapper for the SSLSocketFactory to work aroung jdk1.4 ignoring the timeout system settings. Also support timeout config values.

Author:
Steve Hicks S.J.C.Hicks@rl.ac.uk, Joni Hahkala joni.hahkala@cern.ch, Frantisek Dvorak

Constructor Summary
TimeoutSSLSocketFactory(javax.net.ssl.SSLSocketFactory realFactory, java.util.Properties config)
          Creates a new TimedOutSSLSocketFactory.
 
Method Summary
 java.net.Socket createSocket()
          Creates socket with read timeout defined by either sslTimeout sun.net.client.defaultReadTimeout.
 java.net.Socket createSocket(java.net.InetAddress host, int port)
          Creates socket and connects with timeouts defined by either sslConnectTimeout and sslTimeout or sun.net.client.defaultConnectTimeout and sun.net.client.defaultReadTimeout.
 java.net.Socket createSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddress, int localPort)
          Creates socket with timeout defined by either sslTimeout sun.net.client.defaultReadTimeout.
 java.net.Socket createSocket(java.net.Socket s, java.lang.String host, int port, boolean autoClose)
          Creates socket with timeout defined by either sslTimeout sun.net.client.defaultReadTimeout.
 java.net.Socket createSocket(java.lang.String host, int port)
          Creates socket and connects with timeouts defined by either sslConnectTimeout and sslTimeout or sun.net.client.defaultConnectTimeout and sun.net.client.defaultReadTimeout.
 java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localHost, int localPort)
          Creates socket with timeout defined by either sslTimeout sun.net.client.defaultReadTimeout.
 java.lang.String[] getDefaultCipherSuites()
           
 java.lang.String[] getSupportedCipherSuites()
           
 void setTimeout(java.net.Socket socket)
          Sets the socket read timeout value
 
Methods inherited from class javax.net.ssl.SSLSocketFactory
getDefault
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeoutSSLSocketFactory

public TimeoutSSLSocketFactory(javax.net.ssl.SSLSocketFactory realFactory,
                               java.util.Properties config)
Creates a new TimedOutSSLSocketFactory.

Parameters:
realFactory - Factory used to create sockets.
config - the configuration parameters for this socket factory.
Method Detail

setTimeout

public void setTimeout(java.net.Socket socket)
                throws java.net.SocketException
Sets the socket read timeout value

Parameters:
socket - the socket to configure
Throws:
java.net.SocketException - thrown in case of error

getDefaultCipherSuites

public java.lang.String[] getDefaultCipherSuites()
Specified by:
getDefaultCipherSuites in class javax.net.ssl.SSLSocketFactory
See Also:
SSLSocketFactory.getDefaultCipherSuites()

getSupportedCipherSuites

public java.lang.String[] getSupportedCipherSuites()
Specified by:
getSupportedCipherSuites in class javax.net.ssl.SSLSocketFactory
See Also:
SSLSocketFactory.getSupportedCipherSuites()

createSocket

public java.net.Socket createSocket()
                             throws java.io.IOException
Creates socket with read timeout defined by either sslTimeout sun.net.client.defaultReadTimeout.

Overrides:
createSocket in class javax.net.SocketFactory
Throws:
java.io.IOException
See Also:
SocketFactory.createSocket()

createSocket

public java.net.Socket createSocket(java.net.Socket s,
                                    java.lang.String host,
                                    int port,
                                    boolean autoClose)
                             throws java.io.IOException
Creates socket with timeout defined by either sslTimeout sun.net.client.defaultReadTimeout.

Specified by:
createSocket in class javax.net.ssl.SSLSocketFactory
Throws:
java.io.IOException
See Also:
SSLSocketFactory.createSocket(java.net.Socket, java.lang.String, int, boolean)

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Creates socket and connects with timeouts defined by either sslConnectTimeout and sslTimeout or sun.net.client.defaultConnectTimeout and sun.net.client.defaultReadTimeout.

Specified by:
createSocket in class javax.net.SocketFactory
Throws:
java.io.IOException
java.net.UnknownHostException
See Also:
SocketFactory.createSocket(java.lang.String, int)

createSocket

public java.net.Socket createSocket(java.net.InetAddress host,
                                    int port)
                             throws java.io.IOException
Creates socket and connects with timeouts defined by either sslConnectTimeout and sslTimeout or sun.net.client.defaultConnectTimeout and sun.net.client.defaultReadTimeout.

Specified by:
createSocket in class javax.net.SocketFactory
Throws:
java.io.IOException
See Also:
SocketFactory.createSocket(java.net.InetAddress, int)

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port,
                                    java.net.InetAddress localHost,
                                    int localPort)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Creates socket with timeout defined by either sslTimeout sun.net.client.defaultReadTimeout.

Specified by:
createSocket in class javax.net.SocketFactory
Throws:
java.io.IOException
java.net.UnknownHostException
See Also:
SocketFactory.createSocket(java.lang.String, int, java.net.InetAddress, int)

createSocket

public java.net.Socket createSocket(java.net.InetAddress address,
                                    int port,
                                    java.net.InetAddress localAddress,
                                    int localPort)
                             throws java.io.IOException
Creates socket with timeout defined by either sslTimeout sun.net.client.defaultReadTimeout.

Specified by:
createSocket in class javax.net.SocketFactory
Throws:
java.io.IOException
See Also:
SocketFactory.createSocket(java.net.InetAddress, int, java.net.InetAddress, int)