• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
MultihomePlainSocketFactory Class Reference

Socket factory that implements a simple multi-home fail-over on connect failure, provided the same hostname resolves to multiple java.net.InetAddress. More...

Inheritance diagram for MultihomePlainSocketFactory:
SocketFactory

Description

Please note the (Socket, String, int, InetAddress, int, HttpParams) method cannot be reliably interrupted by closing the socket returned by the () method.

Notice

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...
 

Member Function Documentation

◆ getSocketFactory()

static MultihomePlainSocketFactory getSocketFactory ( )
static
Returns
the one and only plain socket factory

◆ createSocket()

Socket createSocket ( )
Returns
a new socket
Exceptions
IOExceptionif an I/O error occurs while creating the socket

Implements SocketFactory.

◆ connectSocket()

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.

Parameters
socksocket to connect to any of the given addresses
hostHost name to connect to
portthe port to connect to
localAddresslocal address
localPortlocal port
paramsHTTP parameters
Exceptions
IOExceptionif an error occurs during the connection
SocketTimeoutExceptionif timeout expires before connecting

Implements SocketFactory.

◆ isSecure()

final boolean isSecure ( Socket  sock) throws IllegalArgumentException

This factory creates plain socket connections which are not considered secure.

Parameters
sockthe connected socket
Returns
false
Exceptions
IllegalArgumentExceptionif the argument is invalid

Implements SocketFactory.

◆ equals()

boolean equals ( Object  obj)

There is only one instance of this class.

Parameters
objthe object to compare with
Returns
iff the argument is this object

◆ hashCode()

int hashCode ( )

All instances of this class have the same hash code. There is only one instance of this class.