com.sun.faban.driver.transport.util
Class TimedSocketFactory

java.lang.Object
  extended by javax.net.SocketFactory
      extended by com.sun.faban.driver.transport.sunhttp.SocketFactory
          extended by com.sun.faban.driver.transport.util.TimedSocketFactory

public class TimedSocketFactory
extends SocketFactory

Socket factory to create new timed socket.

Author:
Akara Sucharitakul

Constructor Summary
TimedSocketFactory()
           
 
Method Summary
 Socket createSocket()
          Creates a new socket.
 Socket createSocket(InetAddress address, int port)
          Creates a stream socket and connects it to the specified port number at the specified IP address.
 Socket createSocket(InetAddress host, int port, InetAddress localAddr, int localPort)
          Creates a stream socket and connects it to the specified port using a specified local address and port.
 Socket createSocket(Proxy proxy)
          Creates a socket through the given proxy.
 Socket createSocket(String host, int port)
          Creates a new socket connected to the given host and port.
 Socket createSocket(String host, int port, InetAddress localAddr, int localPort)
          Creates a stream socket and connects it to the specified port using a specified local address and port.
 
Methods inherited from class javax.net.SocketFactory
getDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimedSocketFactory

public TimedSocketFactory()
Method Detail

createSocket

public Socket createSocket(Proxy proxy)
Creates a socket through the given proxy.

Specified by:
createSocket in class SocketFactory
Parameters:
proxy - The proxy
Returns:
The socket

createSocket

public Socket createSocket()
                    throws IOException
Creates a new socket.

Overrides:
createSocket in class SocketFactory
Returns:
The newly created socket
Throws:
IOException - Error creating the socket

createSocket

public Socket createSocket(String host,
                           int port)
                    throws IOException,
                           UnknownHostException
Creates a new socket connected to the given host and port.

Specified by:
createSocket in class SocketFactory
Parameters:
host - The host to connect
port - The port to use
Returns:
The newly created and connected socket
Throws:
IOException - Error creating the socket
UnknownHostException - The host is unknown

createSocket

public Socket createSocket(String host,
                           int port,
                           InetAddress localAddr,
                           int localPort)
                    throws IOException,
                           UnknownHostException
Creates a stream socket and connects it to the specified port using a specified local address and port.

Specified by:
createSocket in class SocketFactory
Parameters:
host - the name of the remote host, or null for the loopback address.
port - the remote port
localAddr - the local address the socket is bound to
localPort - the local port the socket is bound to
Returns:
The newly created and connected socket
Throws:
IOException - if an I/O error occurs when creating the socket.
UnknownHostException - The host is unknown

createSocket

public Socket createSocket(InetAddress address,
                           int port)
                    throws IOException
Creates a stream socket and connects it to the specified port number at the specified IP address. *

Specified by:
createSocket in class SocketFactory
Parameters:
address - the IP address.
port - the port number.
Returns:
The newly created and connected socket
Throws:
IOException - if an I/O error occurs when creating the socket.

createSocket

public Socket createSocket(InetAddress host,
                           int port,
                           InetAddress localAddr,
                           int localPort)
                    throws IOException
Creates a stream socket and connects it to the specified port using a specified local address and port.

Specified by:
createSocket in class SocketFactory
Parameters:
host - the address of the remote host
port - the remote port
localAddr - the local address the socket is bound to
localPort - the local port the socket is bound to
Returns:
The newly created and connected socket
Throws:
IOException - if an I/O error occurs when creating the socket.