Interface ConnectionSocketFactory

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default java.net.Socket connectSocket​(java.net.Socket socket, org.apache.hc.core5.http.HttpHost host, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, org.apache.hc.core5.util.Timeout connectTimeout, java.lang.Object attachment, org.apache.hc.core5.http.protocol.HttpContext context)
      Connects the socket to the target host with the given resolved remote address.
      java.net.Socket connectSocket​(org.apache.hc.core5.util.TimeValue connectTimeout, java.net.Socket socket, org.apache.hc.core5.http.HttpHost host, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, org.apache.hc.core5.http.protocol.HttpContext context)
      Connects the socket to the target host with the given resolved remote address.
      default java.net.Socket createSocket​(java.net.Proxy proxy, org.apache.hc.core5.http.protocol.HttpContext context)
      Creates new, unconnected socket via a proxy (generally SOCKS is expected).
      java.net.Socket createSocket​(org.apache.hc.core5.http.protocol.HttpContext context)
      Creates new, unconnected socket.
    • Method Detail

      • createSocket

        java.net.Socket createSocket​(org.apache.hc.core5.http.protocol.HttpContext context)
                              throws java.io.IOException
        Creates new, unconnected socket. The socket should subsequently be passed to connectSocket method.
        Throws:
        java.io.IOException
      • createSocket

        @Internal
        default java.net.Socket createSocket​(java.net.Proxy proxy,
                                             org.apache.hc.core5.http.protocol.HttpContext context)
                                      throws java.io.IOException
        Creates new, unconnected socket via a proxy (generally SOCKS is expected). The socket should subsequently be passed to connectSocket method.
        Throws:
        java.io.IOException
        Since:
        5.2
      • connectSocket

        java.net.Socket connectSocket​(org.apache.hc.core5.util.TimeValue connectTimeout,
                                      java.net.Socket socket,
                                      org.apache.hc.core5.http.HttpHost host,
                                      java.net.InetSocketAddress remoteAddress,
                                      java.net.InetSocketAddress localAddress,
                                      org.apache.hc.core5.http.protocol.HttpContext context)
                               throws java.io.IOException
        Connects the socket to the target host with the given resolved remote address.
        Parameters:
        connectTimeout - connect timeout.
        socket - the socket to connect, as obtained from createSocket(HttpContext). null indicates that a new socket should be created and connected.
        host - target host as specified by the caller (end user).
        remoteAddress - the resolved remote address to connect to.
        localAddress - the local address to bind the socket to, or null for any.
        context - the actual HTTP context.
        Returns:
        the connected socket. The returned object may be different from the sock argument if this factory supports a layered protocol.
        Throws:
        java.io.IOException - if an I/O error occurs
      • connectSocket

        default java.net.Socket connectSocket​(java.net.Socket socket,
                                              org.apache.hc.core5.http.HttpHost host,
                                              java.net.InetSocketAddress remoteAddress,
                                              java.net.InetSocketAddress localAddress,
                                              org.apache.hc.core5.util.Timeout connectTimeout,
                                              java.lang.Object attachment,
                                              org.apache.hc.core5.http.protocol.HttpContext context)
                                       throws java.io.IOException
        Connects the socket to the target host with the given resolved remote address.
        Parameters:
        socket - the socket to connect, as obtained from createSocket(HttpContext). null indicates that a new socket should be created and connected.
        host - target host as specified by the caller (end user).
        remoteAddress - the resolved remote address to connect to.
        localAddress - the local address to bind the socket to, or null for any.
        connectTimeout - connect timeout.
        attachment - connect request attachment.
        context - the actual HTTP context.
        Returns:
        the connected socket. The returned object may be different from the sock argument if this factory supports a layered protocol.
        Throws:
        java.io.IOException - if an I/O error occurs
        Since:
        5.2