org.apache.http.conn

## Class MultihomePlainSocketFactory

- java.lang.Object
- - org.apache.http.conn.MultihomePlainSocketFactory

All Implemented Interfaces:
  SocketFactory

Deprecated.
(4.1) Do not use. For multihome support socket factories must implement `SchemeSocketFactory` interface.

    @Deprecated
    @Contract(threading=IMMUTABLE)
    public final class MultihomePlainSocketFactory
    extends Object
    implements SocketFactory

Socket factory that implements a simple multi-home fail-over on connect failure, provided the same hostname resolves to multiple `InetAddress`es. 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

### Method Summary

Methods
`Socket` `connectSocket(Socket socket, String host, int port, InetAddress localAddress, int localPort, org.apache.http.params.HttpParams params)` Deprecated. Attempts to connects the socket to any of the `InetAddress`es the given host name resolves to.
`Socket` `createSocket()` Deprecated. Creates a new, unconnected socket.
`static MultihomePlainSocketFactory` `getSocketFactory()` Deprecated. Gets the singleton instance of this class.
`boolean` `isSecure(Socket sock)` Deprecated. Checks whether a socket connection is secure.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### getSocketFactory

    public static MultihomePlainSocketFactory getSocketFactory()

Deprecated.
Gets the singleton instance of this class.

Returns:
  the one and only plain socket factory

#### createSocket

    public Socket createSocket()

Deprecated.
Description copied from interface: `SocketFactory`
Creates a new, unconnected socket. The socket should subsequently be passed to `connectSocket`.

Specified by:
  `createSocket` in interface `SocketFactory`
Returns:
  a new socket

#### connectSocket

    public Socket connectSocket(Socket socket,
                       String host,
                       int port,
                       InetAddress localAddress,
                       int localPort,
                       org.apache.http.params.HttpParams params)
                         throws IOException

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

Specified by:
  `connectSocket` in interface `SocketFactory`
Parameters:
  `socket` - 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

#### isSecure

    public boolean isSecure(Socket sock)
                     throws IllegalArgumentException

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

Specified by:
  `isSecure` in interface `SocketFactory`
Parameters:
  `sock` - the connected socket
Returns:
  `false`
Throws:
  `IllegalArgumentException` - if the argument is invalid