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

public final Class MultihomePlainSocketFactory

extends Object
implements SocketFactory
Class Inheritance
All Implemented Interfaces
org.apache.http.conn.scheme.SocketFactory
Annotations
@Deprecated
@Contract
threading:IMMUTABLE
Imports
java.io.IOException, java.net.InetAddress, .InetSocketAddress, .Socket, .SocketTimeoutException, java.util.ArrayList, .Arrays, .Collections, .List, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.conn.scheme.SocketFactory, org.apache.http.params.HttpConnectionParams, .HttpParams, org.apache.http.util.Args, .Asserts

Deprecated

(4.1) Do not use. For multihome support socket factories must implement org.apache.http.conn.scheme.SchemeSocketFactory interface.

Socket factory that implements a simple multi-home fail-over on connect failure, provided the same hostname resolves to multiple InetAddresses. Please note the connectSocket(Socket, String, int, InetAddress, int, HttpParams) method cannot be reliably interrupted by closing the socket returned by the createSocket() method.
Since
4.0

Field Summary

Modifier and TypeField and Description
private static final MultihomePlainSocketFactory
DEFAULT_FACTORY

The factory singleton.

Constructor Summary

AccessConstructor and Description
private
MultihomePlainSocketFactory()

Restricted default constructor.

Method Summary

Modifier and TypeMethod and Description
public Socket
connectSocket(final Socket
socket to connect to any of the given addresses
socket
,
final String
Host name to connect to
host
,
final int
the port to connect to
port
,
final InetAddress
local address
localAddress
,
final int
local port
localPort
,
final HttpParams
HTTP parameters
params
)

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

Deprecated as a consequence of HttpParams being deprecated.
Attempts to connects the socket to any of the InetAddresses the given host name resolves to.
public Socket
createSocket()

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

Creates a new, unconnected socket.
public static MultihomePlainSocketFactory

Returns:

the one and only plain socket factory
getSocketFactory
()

Deprecated as a consequence of MultihomePlainSocketFactory being deprecated.
Gets the singleton instance of this class.
public boolean

Returns:

false
isSecure
(final Socket
the connected socket
sock
)

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

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

Field Detail

DEFAULT_FACTORYback to summary
private static final MultihomePlainSocketFactory DEFAULT_FACTORY

Deprecated

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

The factory singleton.

Constructor Detail

MultihomePlainSocketFactoryback to summary
private MultihomePlainSocketFactory()

Restricted default constructor.

Method Detail

connectSocketback to summary
public Socket connectSocket(final Socket socket, final String host, final int port, final InetAddress localAddress, final int localPort, final HttpParams params) throws IOException

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

Deprecated

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

Attempts to connects the socket to any of the InetAddresses the given host name resolves to. If connection to all addresses fail, the last I/O exception is propagated to the caller.

Parameters
socket:Socket

socket to connect to any of the given addresses

host:String

Host name to connect to

port:int

the port to connect to

localAddress:InetAddress

local address

localPort:int

local port

params:HttpParams

HTTP parameters

Returns:Socket

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

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 error occurs during the connection
SocketTimeoutException:
if timeout expires before connecting
createSocketback to summary
public Socket createSocket()

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

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

Creates a new, unconnected socket. The socket should subsequently be passed to connectSocket.

Returns:Socket

a new socket

Annotations
@Override
getSocketFactoryback to summary
public static MultihomePlainSocketFactory getSocketFactory()

Deprecated

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

Gets the singleton instance of this class.

Returns:MultihomePlainSocketFactory

the one and only plain socket factory

isSecureback to summary
public boolean isSecure(final Socket sock) throws IllegalArgumentException

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

Checks whether a socket connection is secure. This factory creates plain socket connections which are not considered secure.

Parameters
sock:Socket

the connected socket

Returns:boolean

false

Annotations
@Override
Exceptions
IllegalArgumentException:
if the argument is invalid