Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.httpclient.protocol
Class ReflectionSocketFactory

    java.lang.Object
      org.apache.commons.httpclient.protocol.ReflectionSocketFactory

    public final class ReflectionSocketFactory

extends Object

This helper class uses refelction in order to execute Socket methods available in Java 1.4 and above

Since:
  3.0
Author:
  Oleg Kalnichevski

Method Summary
`static Socket` | `createSocket(String socketfactoryName, String host, int port, InetAddress localAddress, int localPort, int timeout)` This method attempts to execute Socket method available since Java 1.4 using reflection.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### createSocket

    public static Socket createSocket(String socketfactoryName,
                                      String host,
                                      int port,
                                      InetAddress localAddress,
                                      int localPort,
                                      int timeout)
                               throws IOException,
                                      UnknownHostException,
                                      ConnectTimeoutException

  This method attempts to execute Socket method available since Java 1.4 using reflection. If the methods are not available or could not be executed `null` is returned

  Parameters:
    `socketfactoryName` - name of the socket factory class
    `host` - the host name/IP
    `port` - the port on the host
    `localAddress` - the local host name/IP to bind the socket to
    `localPort` - the port on the local machine
    `timeout` - the timeout value to be used in milliseconds. If the socket cannot be completed within the given time limit, it will be abandoned
  Returns:
    a connected Socket
  Throws:
    `IOException` - if an I/O error occurs while creating the socket
    `UnknownHostException` - if the IP address of the host cannot be determined
    `ConnectTimeoutException` - if socket cannot be connected within the given time limit

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.