Socket factory that implements a simple multi-home fail-over on connect failure, provided the same hostname resolves to multiple java.net.InetAddress. More...
Please note the (Socket, String, int, InetAddress, int, HttpParams) method cannot be reliably interrupted by closing the socket returned by the () method.
The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.
/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Public Member Functions | |
Socket | createSocket () |
Creates a new, unconnected socket. More... | |
Socket | connectSocket (Socket sock, String host, int port, InetAddress localAddress, int localPort, HttpParams params) throws IOException |
Attempts to connects the socket to any of the java.net.InetAddress the given host name resolves to. More... | |
final boolean | isSecure (Socket sock) throws IllegalArgumentException |
Checks whether a socket connection is secure. More... | |
boolean | equals (Object obj) |
Compares this factory with an object. More... | |
int | hashCode () |
Obtains a hash code for this object. More... | |
Static Public Member Functions | |
static MultihomePlainSocketFactory | getSocketFactory () |
Gets the singleton instance of this class. More... | |
|
static |
Socket createSocket | ( | ) |
IOException | if an I/O error occurs while creating the socket |
Implements SocketFactory.
Socket connectSocket | ( | Socket | sock, |
String | host, | ||
int | port, | ||
InetAddress | localAddress, | ||
int | localPort, | ||
HttpParams | params | ||
) | throws IOException |
If connection to all addresses fail, the last I/O exception is propagated to the caller.
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 |
IOException | if an error occurs during the connection |
SocketTimeoutException | if timeout expires before connecting |
Implements SocketFactory.
final boolean isSecure | ( | Socket | sock | ) | throws IllegalArgumentException |
This factory creates plain socket connections which are not considered secure.
sock | the connected socket |
false
IllegalArgumentException | if the argument is invalid |
Implements SocketFactory.
boolean equals | ( | Object | obj | ) |
There is only one instance of this class.
obj | the object to compare with |
int hashCode | ( | ) |
All instances of this class have the same hash code. There is only one instance of this class.