org.apache.hc.client5.http.socket

## Interface ConnectionSocketFactory

- All Known Subinterfaces:
    LayeredConnectionSocketFactory
  All Known Implementing Classes:
    PlainConnectionSocketFactory, SSLConnectionSocketFactory

  Deprecated.
  Do not use.

      @Contract(threading=STATELESS)
       @Deprecated
      public interface ConnectionSocketFactory

  A factory for creating and connecting connection sockets.

- - ### Method Summary

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

- - ### Method Detail

    - #### createSocket

          Socket createSocket(org.apache.hc.core5.http.protocol.HttpContext context)
                       throws IOException

      Deprecated.
      Creates new, unconnected socket. The socket should subsequently be passed to `connectSocket` method.
      Throws:
        `IOException`

    - #### createSocket

          @Internal
          default Socket createSocket(Proxy proxy,
                                                org.apache.hc.core5.http.protocol.HttpContext context)
                                         throws IOException

      Deprecated.
      Creates new, unconnected socket via a proxy (generally SOCKS is expected). The socket should subsequently be passed to `connectSocket` method.
      Throws:
        `IOException`
      Since:
        5.2

    - #### connectSocket

          Socket connectSocket(org.apache.hc.core5.util.TimeValue connectTimeout,
                               Socket socket,
                               org.apache.hc.core5.http.HttpHost host,
                               InetSocketAddress remoteAddress,
                               InetSocketAddress localAddress,
                               org.apache.hc.core5.http.protocol.HttpContext context)
                        throws IOException

      Deprecated.
      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:
        `IOException` - if an I/O error occurs

    - #### connectSocket

          default Socket connectSocket(Socket socket,
                                       org.apache.hc.core5.http.HttpHost host,
                                       InetSocketAddress remoteAddress,
                                       InetSocketAddress localAddress,
                                       org.apache.hc.core5.util.Timeout connectTimeout,
                                       Object attachment,
                                       org.apache.hc.core5.http.protocol.HttpContext context)
                                throws IOException

      Deprecated.
      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:
        `IOException` - if an I/O error occurs
      Since:
        5.2

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.