Class ReflectionSocketFactory


  • @Deprecated
    public final class ReflectionSocketFactory
    extends java.lang.Object
    Deprecated.
    Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.
    This helper class uses refelction in order to execute Socket methods available in Java 1.4 and above
    Since:
    3.0
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.net.Socket createSocket​(java.lang.String socketfactoryName, java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, int timeout)
      Deprecated.
      This method attempts to execute Socket method available since Java 1.4 using reflection.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createSocket

        public static java.net.Socket createSocket​(java.lang.String socketfactoryName,
                                                   java.lang.String host,
                                                   int port,
                                                   java.net.InetAddress localAddress,
                                                   int localPort,
                                                   int timeout)
                                            throws java.io.IOException,
                                                   java.net.UnknownHostException,
                                                   ConnectTimeoutException
        Deprecated.
        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:
        java.io.IOException - if an I/O error occurs while creating the socket
        java.net.UnknownHostException - if the IP address of the host cannot be determined
        ConnectTimeoutException - if socket cannot be connected within the given time limit