org.apache.http.impl.io
Class PlainSocketFactory

java.lang.Object
  extended by org.apache.http.impl.io.PlainSocketFactory
All Implemented Interfaces:
SocketFactory

public class PlainSocketFactory
extends java.lang.Object
implements SocketFactory

The default class for creating protocol sockets. This class just uses the socket constructors.

Since:
2.0
Author:
Michael Becke

Method Summary
 java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, HttpParams params)
          Attempts to get a new socket connection to using old (pre Java 1.4) IO mode.
 boolean equals(java.lang.Object obj)
          All instances of DefaultProtocolSocketFactory are the same.
static PlainSocketFactory getSocketFactory()
          Gets an singleton instance of the DefaultProtocolSocketFactory.
 int hashCode()
          All instances of DefaultProtocolSocketFactory have the same hash code.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSocketFactory

public static PlainSocketFactory getSocketFactory()
Gets an singleton instance of the DefaultProtocolSocketFactory.

Returns:
a DefaultProtocolSocketFactory

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port,
                                    java.net.InetAddress localAddress,
                                    int localPort,
                                    HttpParams params)
                             throws java.io.IOException,
                                    java.net.UnknownHostException
Attempts to get a new socket connection to using old (pre Java 1.4) IO mode. This socket factory does not support connect timeout as it requires Java 1.4 functionality.

Specified by:
createSocket in interface SocketFactory
Parameters:
host - the host name/IP
port - the port on the host
localAddress - the local host name/IP to bind the socket to
localPort - the port on the local machine
params - Http connection parameters
Returns:
Socket a new socket
Throws:
java.io.IOException - if an I/O error occurs while creating the socket
java.net.UnknownHostException - if the IP address of the host cannot be
java.lang.IllegalStateException - if connection timeout is set determined
Since:
3.0

equals

public boolean equals(java.lang.Object obj)
All instances of DefaultProtocolSocketFactory are the same.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
All instances of DefaultProtocolSocketFactory have the same hash code.

Overrides:
hashCode in class java.lang.Object


Copyright 2005-2005-2006 Apache Software Foundation. All Rights Reserved.