org.apache.hc.client5.http.socket

## Interface LayeredConnectionSocketFactory

- All Superinterfaces:
    ConnectionSocketFactory
  All Known Implementing Classes:
    SSLConnectionSocketFactory

      @Contract(threading=STATELESS)
      public interface LayeredConnectionSocketFactory
      extends ConnectionSocketFactory

  Extended `ConnectionSocketFactory` interface for layered sockets such as SSL/TLS.
  Since:
    4.3

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `Socket` | `createLayeredSocket(Socket socket, String target, int port, org.apache.hc.core5.http.protocol.HttpContext context)` Returns a socket connected to the given host that is layered over an existing socket.
    `default Socket` | `createLayeredSocket(Socket socket, String target, int port, Object attachment, org.apache.hc.core5.http.protocol.HttpContext context)` Returns a socket connected to the given host that is layered over an existing socket.

    - ### Methods inherited from interface org.apache.hc.client5.http.socket.ConnectionSocketFactory

      `connectSocket, connectSocket, createSocket`

- - ### Method Detail

    - #### createLayeredSocket

          Socket createLayeredSocket(Socket socket,
                                     String target,
                                     int port,
                                     org.apache.hc.core5.http.protocol.HttpContext context)
                              throws IOException

      Returns a socket connected to the given host that is layered over an existing socket. Used primarily for creating secure sockets through proxies.
      Parameters:
        `socket` - the existing socket
        `target` - the name of the target host.
        `port` - the port to connect to on the target host.
        `context` - the actual HTTP context.
      Returns:
        Socket a new socket
      Throws:
        `IOException` - if an I/O error occurs while creating the socket

    - #### createLayeredSocket

          default Socket createLayeredSocket(Socket socket,
                                             String target,
                                             int port,
                                             Object attachment,
                                             org.apache.hc.core5.http.protocol.HttpContext context)
                                      throws IOException

      Returns a socket connected to the given host that is layered over an existing socket. Used primarily for creating secure sockets through proxies.
      Parameters:
        `socket` - the existing socket
        `target` - the name of the target host.
        `port` - the port to connect to on the target host.
        `context` - the actual HTTP context.
        `attachment` - connect request attachment.
      Returns:
        Socket a new socket
      Throws:
        `IOException` - if an I/O error occurs while creating the socket
      Since:
        5.2

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