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

pack-priv Class SchemeSocketFactoryAdaptor

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

Deprecated

(4.1) do not use

Field Summary

Modifier and TypeField and Description
private final SocketFactory
factory

Deprecated as a consequence of SocketFactory being deprecated.

Constructor Summary

AccessConstructor and Description
pack-priv
SchemeSocketFactoryAdaptor(final SocketFactory factory)

Deprecated as a consequence of SocketFactory 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
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
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public SocketFactory
getFactory()

Deprecated as a consequence of SocketFactory being deprecated.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
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:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

factoryback to summary
private final SocketFactory factory

Deprecated

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

Constructor Detail

SchemeSocketFactoryAdaptorback to summary
pack-priv SchemeSocketFactoryAdaptor(final SocketFactory factory)

Deprecated

as a consequence of SocketFactory 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
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
equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getFactoryback to summary
public SocketFactory getFactory()

Deprecated

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

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
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.