Interface ProtocolSocketFactory
-
- All Known Subinterfaces:
SecureProtocolSocketFactory
- All Known Implementing Classes:
DefaultProtocolSocketFactory
,EasySSLProtocolSocketFactory
,SSLProtocolSocketFactory
public interface ProtocolSocketFactory
A factory for creating Sockets.Both
Object.equals()
andObject.hashCode()
should be overridden appropriately. Protocol socket factories are used to uniquely identifyProtocol
s andHostConfiguration
s, andequals()
andhashCode()
are required for the correct operation of some connection managers.- Since:
- 2.0
- See Also:
Protocol
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.net.Socket
createSocket(java.lang.String host, int port)
Gets a new socket connection to the given host.java.net.Socket
createSocket(java.lang.String host, int port, java.net.InetAddress localAddress, int localPort)
Gets a new socket connection to the given host.java.net.Socket
createSocket(java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, HttpConnectionParams params)
Gets a new socket connection to the given host.
-
-
-
Method Detail
-
createSocket
java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localAddress, int localPort) throws java.io.IOException, java.net.UnknownHostException
Gets a new socket connection to the given host.- Parameters:
host
- the host name/IPport
- the port on the hostlocalAddress
- the local host name/IP to bind the socket tolocalPort
- the port on the local machine- Returns:
- Socket a new socket
- Throws:
java.io.IOException
- if an I/O error occurs while creating the socketjava.net.UnknownHostException
- if the IP address of the host cannot be determined
-
createSocket
java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, HttpConnectionParams params) throws java.io.IOException, java.net.UnknownHostException, ConnectTimeoutException
Gets a new socket connection to the given host.- Parameters:
host
- the host name/IPport
- the port on the hostlocalAddress
- the local host name/IP to bind the socket tolocalPort
- the port on the local machineparams
-Http connection parameters
- Returns:
- Socket a new socket
- Throws:
java.io.IOException
- if an I/O error occurs while creating the socketjava.net.UnknownHostException
- if the IP address of the host cannot be determinedConnectTimeoutException
- if socket cannot be connected within the given time limit- Since:
- 3.0
-
createSocket
java.net.Socket createSocket(java.lang.String host, int port) throws java.io.IOException, java.net.UnknownHostException
Gets a new socket connection to the given host.- Parameters:
host
- the host name/IPport
- the port on the host- Returns:
- Socket a new socket
- Throws:
java.io.IOException
- if an I/O error occurs while creating the socketjava.net.UnknownHostException
- if the IP address of the host cannot be determined
-
-