Stay organized with collections
Save and categorize content based on your preferences.
LayeredSocketFactory
public
interface
LayeredSocketFactory
implements
SocketFactory
org.apache.http.conn.scheme.LayeredSocketFactory
|
Known indirect subclasses
|
This interface was deprecated
in API level 22.
Please use URL.openConnection()
instead.
Please visit this webpage
for further details.
A SocketFactory
for layered sockets (SSL/TLS).
See there for things to consider when implementing a socket factory.
Summary
Public methods |
abstract
Socket
|
createSocket(Socket socket, String host, int port, boolean autoClose)
Returns a socket connected to the given host that is layered over an
existing socket.
|
Public methods
createSocket
public abstract Socket createSocket (Socket socket,
String host,
int port,
boolean autoClose)
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 |
Socket : the existing socket |
host |
String : the host name/IP |
port |
int : the port on the host |
autoClose |
boolean : a flag for closing the underling socket when the created
socket is closed |
Returns |
Socket |
Socket a new socket |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# LayeredSocketFactory\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nDeprecated in [API level\n22](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nLayeredSocketFactory\n====================\n\n\n`\npublic\n\n\ninterface\nLayeredSocketFactory\n`\n\n\n`\n\n\nimplements\n\n`[SocketFactory](/reference/org/apache/http/conn/scheme/SocketFactory)`\n\n\n`\n\n|--------------------------------------------------|\n| org.apache.http.conn.scheme.LayeredSocketFactory |\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [SSLSocketFactory](/reference/org/apache/http/conn/ssl/SSLSocketFactory) |--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [SSLSocketFactory](/reference/org/apache/http/conn/ssl/SSLSocketFactory) | *This class was deprecated in API level 22. Please use [URL.openConnection()](/reference/java/net/URL#openConnection()) instead. Please visit [this webpage](http://android-developers.blogspot.com/2011/09/androids-http-clients.html) for further details.* | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\n**This interface was deprecated\nin API level 22.** \n\nPlease use [URL.openConnection()](/reference/java/net/URL#openConnection()) instead.\nPlease visit [this webpage](http://android-developers.blogspot.com/2011/09/androids-http-clients.html)\nfor further details.\n\nA [SocketFactory](/reference/org/apache/http/conn/scheme/SocketFactory) for layered sockets (SSL/TLS).\nSee there for things to consider when implementing a socket factory.\n\nSummary\n-------\n\n| ### Public methods ||\n|--------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract `[Socket](/reference/java/net/Socket) | ` `[createSocket](/reference/org/apache/http/conn/scheme/LayeredSocketFactory#createSocket(java.net.Socket,%20java.lang.String,%20int,%20boolean))`(`[Socket](/reference/java/net/Socket)` socket, `[String](/reference/java/lang/String)` host, int port, boolean autoClose) ` Returns a socket connected to the given host that is layered over an existing socket. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[org.apache.http.conn.scheme.SocketFactory](/reference/org/apache/http/conn/scheme/SocketFactory)` ` |--------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Socket](/reference/java/net/Socket) | ` `[connectSocket](/reference/org/apache/http/conn/scheme/SocketFactory#connectSocket(java.net.Socket,%20java.lang.String,%20int,%20java.net.InetAddress,%20int,%20org.apache.http.params.HttpParams))`(`[Socket](/reference/java/net/Socket)` sock, `[String](/reference/java/lang/String)` host, int port, `[InetAddress](/reference/java/net/InetAddress)` localAddress, int localPort, `[HttpParams](/reference/org/apache/http/params/HttpParams)` params) ` Connects a socket to the given host. | | ` abstract `[Socket](/reference/java/net/Socket) | ` `[createSocket](/reference/org/apache/http/conn/scheme/SocketFactory#createSocket())`() ` Creates a new, unconnected socket. | | ` abstract boolean` | ` `[isSecure](/reference/org/apache/http/conn/scheme/SocketFactory#isSecure(java.net.Socket))`(`[Socket](/reference/java/net/Socket)` sock) ` Checks whether a socket provides a secure connection. | ||\n\nPublic methods\n--------------\n\n### createSocket\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract Socket createSocket (Socket socket, \n String host, \n int port, \n boolean autoClose)\n```\n\nReturns a socket connected to the given host that is layered over an\nexisting socket. Used primarily for creating secure sockets through\nproxies.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------|---------------------------------------------------------------------------------------------|\n| `socket` | `Socket`: the existing socket \u003cbr /\u003e |\n| `host` | `String`: the host name/IP \u003cbr /\u003e |\n| `port` | `int`: the port on the host \u003cbr /\u003e |\n| `autoClose` | `boolean`: a flag for closing the underling socket when the created socket is closed \u003cbr /\u003e |\n\n| Returns ||\n|--------------------------------------|----------------------------|\n| [Socket](/reference/java/net/Socket) | Socket a new socket \u003cbr /\u003e |\n\n| Throws ||\n|------------------------------------------------------------------|----------------------------------------------------|\n| [IOException](/reference/java/io/IOException) | if an I/O error occurs while creating the socket |\n| [UnknownHostException](/reference/java/net/UnknownHostException) | if the IP address of the host cannot be determined |"]]