Package org.apache.http.conn.scheme
Class PlainSocketFactory
java.lang.Object
org.apache.http.conn.scheme.PlainSocketFactory
- All Implemented Interfaces:
SchemeSocketFactory
,SocketFactory
@Contract(threading=IMMUTABLE)
@Deprecated
public class PlainSocketFactory
extends Object
implements SocketFactory, SchemeSocketFactory
Deprecated.
The default class for creating plain (unencrypted) sockets.
- Since:
- 4.0
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.PlainSocketFactory
(HostNameResolver nameResolver) Deprecated.(4.1) useDnsResolver
-
Method Summary
Modifier and TypeMethodDescriptionconnectSocket
(Socket socket, String host, int port, InetAddress localAddress, int localPort, HttpParams params) Deprecated.connectSocket
(Socket socket, InetSocketAddress remoteAddress, InetSocketAddress localAddress, HttpParams params) Deprecated.Connects a socket to the target host with the given remote address.Deprecated.Creates a new, unconnected socket.createSocket
(HttpParams params) Deprecated.Creates a new, unconnected socket.static PlainSocketFactory
Deprecated.Gets the default factory.final boolean
Deprecated.Checks whether a socket connection is secure.
-
Constructor Details
-
PlainSocketFactory
Deprecated.(4.1) useDnsResolver
-
PlainSocketFactory
public PlainSocketFactory()Deprecated.
-
-
Method Details
-
getSocketFactory
Deprecated.Gets the default factory.- Returns:
- the default factory
-
createSocket
Deprecated.Description copied from interface:SchemeSocketFactory
Creates a new, unconnected socket. The socket should subsequently be passed toSchemeSocketFactory.connectSocket(Socket, InetSocketAddress, InetSocketAddress, HttpParams)
.- Specified by:
createSocket
in interfaceSchemeSocketFactory
- Parameters:
params
- Optional parameters. Parameters passed to this method will have no effect. This method will create a unconnected instance ofSocket
class using default constructor.- Returns:
- a new socket
- Since:
- 4.1
-
createSocket
Deprecated.Description copied from interface:SocketFactory
Creates a new, unconnected socket. The socket should subsequently be passed toconnectSocket
.- Specified by:
createSocket
in interfaceSocketFactory
- Returns:
- a new socket
-
connectSocket
public Socket connectSocket(Socket socket, InetSocketAddress remoteAddress, InetSocketAddress localAddress, HttpParams params) throws IOException, ConnectTimeoutException Deprecated.Description copied from interface:SchemeSocketFactory
Connects a socket to the target host with the given remote address.Please note that
HttpInetSocketAddress
class should be used in order to pass the target remote address along with the originalHttpHost
value used to resolve the address. The use ofHttpInetSocketAddress
can also ensure that no reverse DNS lookup will be performed if the target remote address was specified as an IP address.- Specified by:
connectSocket
in interfaceSchemeSocketFactory
- Parameters:
socket
- the socket to connect, as obtained fromcreateSocket
.null
indicates that a new socket should be created and connected.remoteAddress
- the remote address to connect to.localAddress
- the local address to bind the socket to, ornull
for anyparams
- additionalparameters
for connecting- Returns:
- the connected socket. The returned object may be different
from the
sock
argument if this factory supports a layered protocol. - Throws:
IOException
- if an I/O error occursConnectTimeoutException
- if the socket cannot be connected within the time limit defined in theparams
- Since:
- 4.1
- See Also:
-
isSecure
Deprecated.Checks whether a socket connection is secure. This factory creates plain socket connections which are not considered secure.- Specified by:
isSecure
in interfaceSchemeSocketFactory
- Specified by:
isSecure
in interfaceSocketFactory
- Parameters:
sock
- the connected socket- Returns:
false
-
connectSocket
@Deprecated public Socket connectSocket(Socket socket, String host, int port, InetAddress localAddress, int localPort, HttpParams params) throws IOException, UnknownHostException, ConnectTimeoutException Deprecated.Description copied from interface:SocketFactory
Connects a socket to the given host.- Specified by:
connectSocket
in interfaceSocketFactory
- Parameters:
socket
- the socket to connect, as obtained fromcreateSocket
.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, ornull
for anylocalPort
- the port on the local machine, 0 or a negative number for anyparams
- additionalparameters
for connecting- Returns:
- the connected socket. The returned object may be different
from the
sock
argument if this factory supports a layered protocol. - Throws:
IOException
- if an I/O error occursUnknownHostException
- if the IP address of the target host can not be determinedConnectTimeoutException
- if the socket cannot be connected within the time limit defined in theparams
-
PlainConnectionSocketFactory