public final class PlainSocketFactory extends java.lang.Object implements SocketFactory
The following parameters can be used to customize the behavior of this class:
Constructor and Description |
---|
PlainSocketFactory() |
PlainSocketFactory(HostNameResolver nameResolver) |
Modifier and Type | Method and Description |
---|---|
java.net.Socket |
connectSocket(java.net.Socket sock,
java.lang.String host,
int port,
java.net.InetAddress localAddress,
int localPort,
HttpParams params)
Connects a socket to the given host.
|
java.net.Socket |
createSocket()
Creates a new, unconnected socket.
|
static PlainSocketFactory |
getSocketFactory()
Gets the default factory.
|
boolean |
isSecure(java.net.Socket sock)
Checks whether a socket connection is secure.
|
public PlainSocketFactory(HostNameResolver nameResolver)
public PlainSocketFactory()
public static PlainSocketFactory getSocketFactory()
public java.net.Socket createSocket()
SocketFactory
connectSocket
.createSocket
in interface SocketFactory
public java.net.Socket connectSocket(java.net.Socket sock, java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, HttpParams params) throws java.io.IOException
SocketFactory
connectSocket
in interface SocketFactory
sock
- the socket to connect, as obtained from
createSocket
.
null
indicates that a new socket
should be created and connected.host
- the host to connect toport
- the port to connect to on the hostlocalAddress
- the local address to bind the socket to, or
null
for anylocalPort
- the port on the local machine,
0 or a negative number for anyparams
- additional parameters
for connectingsock
argument if this factory supports
a layered protocol.java.io.IOException
- if an I/O error occursjava.net.UnknownHostException
- if the IP address of the target host
can not be determinedConnectTimeoutException
- if the socket cannot be connected
within the time limit defined in the params
public final boolean isSecure(java.net.Socket sock) throws java.lang.IllegalArgumentException
isSecure
in interface SocketFactory
sock
- the connected socketfalse
java.lang.IllegalArgumentException
- if the argument is invalid