Top Fields Constructors Methods
org.apache.http.conn.scheme

pack-priv Class SchemeLayeredSocketFactoryAdaptor2

extends Object
implements SchemeLayeredSocketFactory
Class Inheritance
All Implemented Interfaces
org.apache.http.conn.scheme.SchemeLayeredSocketFactory, org.apache.http.conn.scheme.SchemeSocketFactory
Annotations
@Deprecated
Imports
java.io.IOException, java.net.InetSocketAddress, .Socket, .UnknownHostException, org.apache.http.conn.ConnectTimeoutException, org.apache.http.params.HttpParams

Deprecated

(4.2) do not use

Field Summary

Modifier and TypeField and Description
private final LayeredSchemeSocketFactory
factory

Deprecated as a consequence of LayeredSchemeSocketFactory being deprecated.

Constructor Summary

AccessConstructor and Description
pack-priv
SchemeLayeredSocketFactoryAdaptor2(final LayeredSchemeSocketFactory factory)

Deprecated as a consequence of LayeredSchemeSocketFactory being deprecated.

Method Summary

Modifier and TypeMethod and Description
public Socket
connectSocket(final Socket
the socket to connect, as obtained from createSocket. null indicates that a new socket should be created and connected.
sock
,
final InetSocketAddress
the remote address to connect to.
remoteAddress
,
final InetSocketAddress
the local address to bind the socket to, or null for any
localAddress
,
final HttpParams
additional parameters for connecting
params
)

Implements org.apache.http.conn.scheme.SchemeSocketFactory.connectSocket.

Deprecated as a consequence of HttpParams being deprecated.
Connects a socket to the target host with the given remote address.
public Socket
createLayeredSocket(final Socket
the existing socket
socket
,
final String
the name of the target host.
target
,
final int
the port to connect to on the target host
port
,
final HttpParams
HTTP parameters
params
)

Implements org.apache.http.conn.scheme.SchemeLayeredSocketFactory.createLayeredSocket.

Deprecated as a consequence of HttpParams being deprecated.
Returns a socket connected to the given host that is layered over an existing socket.
public Socket
createSocket(final HttpParams
Optional parameters. In most cases these parameters will not be required and will have no effect, as usually socket initialization should take place in the connectSocket(Socket, InetSocketAddress, InetSocketAddress, HttpParams) method. However, in rare cases one may want to pass additional parameters to this method in order to create a customized Socket instance, for instance bound to a SOCKS proxy server.
params
)

Implements org.apache.http.conn.scheme.SchemeSocketFactory.createSocket.

Deprecated as a consequence of HttpParams being deprecated.
Creates a new, unconnected socket.
public boolean
isSecure(final Socket
the connected socket to check
sock
)

Implements org.apache.http.conn.scheme.SchemeSocketFactory.isSecure.

Checks whether a socket provides a secure connection.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

factoryback to summary
private final LayeredSchemeSocketFactory factory

Deprecated

as a consequence of LayeredSchemeSocketFactory being deprecated. See corresponding docs for further information.

Constructor Detail

SchemeLayeredSocketFactoryAdaptor2back to summary
pack-priv SchemeLayeredSocketFactoryAdaptor2(final LayeredSchemeSocketFactory factory)

Deprecated

as a consequence of LayeredSchemeSocketFactory being deprecated. See corresponding docs for further information.

Method Detail

connectSocketback to summary
public Socket connectSocket(final Socket sock, final InetSocketAddress remoteAddress, final InetSocketAddress localAddress, final HttpParams params) throws IOException, UnknownHostException, ConnectTimeoutException

Implements org.apache.http.conn.scheme.SchemeSocketFactory.connectSocket.

Doc from org.apache.http.conn.scheme.SchemeSocketFactory.connectSocket.

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

Connects a socket to the target host with the given remote address.

Please note that org.apache.http.conn.HttpInetSocketAddress class should be used in order to pass the target remote address along with the original org.apache.http.HttpHost value used to resolve the address. The use of org.apache.http.conn.HttpInetSocketAddress can also ensure that no reverse DNS lookup will be performed if the target remote address was specified as an IP address.

Parameters
sock:Socket

the socket to connect, as obtained from createSocket. null indicates that a new socket should be created and connected.

remoteAddress:InetSocketAddress

the remote address to connect to.

localAddress:InetSocketAddress

the local address to bind the socket to, or null for any

params:HttpParams

additional parameters for connecting

Returns:Socket

the connected socket. The returned object may be different from the sock argument if this factory supports a layered protocol.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
UnknownHostException:
if the IP address of the target host can not be determined
ConnectTimeoutException:
if the socket cannot be connected within the time limit defined in the params
createLayeredSocketback to summary
public Socket createLayeredSocket(final Socket socket, final String target, final int port, final HttpParams params) throws IOException, UnknownHostException

Implements org.apache.http.conn.scheme.SchemeLayeredSocketFactory.createLayeredSocket.

Doc from org.apache.http.conn.scheme.SchemeLayeredSocketFactory.createLayeredSocket.

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

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

target:String

the name of the target host.

port:int

the port to connect to on the target host

params:HttpParams

HTTP parameters

Returns:Socket

Socket a new socket

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while creating the socket
UnknownHostException:
if the IP address of the host cannot be determined
createSocketback to summary
public Socket createSocket(final HttpParams params) throws IOException

Implements org.apache.http.conn.scheme.SchemeSocketFactory.createSocket.

Doc from org.apache.http.conn.scheme.SchemeSocketFactory.createSocket.

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

Creates a new, unconnected socket. The socket should subsequently be passed to connectSocket(Socket, InetSocketAddress, InetSocketAddress, HttpParams).

Parameters
params:HttpParams

Optional parameters. In most cases these parameters will not be required and will have no effect, as usually socket initialization should take place in the connectSocket(Socket, InetSocketAddress, InetSocketAddress, HttpParams) method. However, in rare cases one may want to pass additional parameters to this method in order to create a customized Socket instance, for instance bound to a SOCKS proxy server.

Returns:Socket

a new socket

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while creating the socket
isSecureback to summary
public boolean isSecure(final Socket sock) throws IllegalArgumentException

Implements org.apache.http.conn.scheme.SchemeSocketFactory.isSecure.

Doc from org.apache.http.conn.scheme.SchemeSocketFactory.isSecure.

Checks whether a socket provides a secure connection. The socket must be connected by this factory. The factory will not perform I/O operations in this method.

As a rule of thumb, plain sockets are not secure and TLS/SSL sockets are secure. However, there may be application specific deviations. For example, a plain socket to a host in the same intranet ("trusted zone") could be considered secure. On the other hand, a TLS/SSL socket could be considered insecure based on the cipher suite chosen for the connection.

Parameters
sock:Socket

the connected socket to check

Returns:boolean

true if the connection of the socket should be considered secure, or false if it should not

Annotations
@Override
Exceptions
IllegalArgumentException:
if the argument is invalid, for example because it is not a connected socket or was created by a different socket factory. Note that socket factories are not required to check these conditions, they may simply return a default value when called with an invalid socket argument.