public final class

MultihomePlainSocketFactory

extends Object
implements SocketFactory
java.lang.Object
   ↳ org.apache.http.conn.MultihomePlainSocketFactory

This class is deprecated.
Do not use. For multihome support socket factories must implement SchemeSocketFactory interface.

Class Overview

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.

Summary

Public Methods
Socket connectSocket(Socket sock, String host, int port, InetAddress localAddress, int localPort, HttpParams params)
Attempts to connects the socket to any of the InetAddresses the given host name resolves to.
Socket createSocket()
Creates a new, unconnected socket.
static MultihomePlainSocketFactory getSocketFactory()
Gets the singleton instance of this class.
final boolean isSecure(Socket sock)
Checks whether a socket connection is secure.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.conn.scheme.SocketFactory

Public Methods

public Socket connectSocket (Socket sock, String host, int port, InetAddress localAddress, int localPort, HttpParams params)

Also: HttpClient

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
sock socket to connect to any of the given addresses
host Host name to connect to
port the port to connect to
localAddress local address
localPort local port
params HTTP parameters
Returns
  • the connected socket. The returned object may be different from the sock argument if this factory supports a layered protocol.
Throws
IOException if an error occurs during the connection
SocketTimeoutException if timeout expires before connecting

public Socket createSocket ()

Also: HttpClient

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

Returns
  • a new socket

public static MultihomePlainSocketFactory getSocketFactory ()

Also: HttpClient

Gets the singleton instance of this class.

Returns
  • the one and only plain socket factory

public final boolean isSecure (Socket sock)

Also: HttpClient

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

Parameters
sock the connected socket
Returns
  • false
Throws
IllegalArgumentException if the argument is invalid