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 java.lang.Object implements SocketFactory, SchemeSocketFactory
Deprecated.(4.3) usePlainConnectionSocketFactoryThe default class for creating plain (unencrypted) sockets.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description PlainSocketFactory()Deprecated.PlainSocketFactory(HostNameResolver nameResolver)Deprecated.(4.1) useDnsResolver
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.net.SocketconnectSocket(java.net.Socket socket, java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, HttpParams params)Deprecated.java.net.SocketconnectSocket(java.net.Socket socket, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, HttpParams params)Deprecated.Connects a socket to the target host with the given remote address.java.net.SocketcreateSocket()Deprecated.Creates a new, unconnected socket.java.net.SocketcreateSocket(HttpParams params)Deprecated.Creates a new, unconnected socket.static PlainSocketFactorygetSocketFactory()Deprecated.Gets the default factory.booleanisSecure(java.net.Socket sock)Deprecated.Checks whether a socket connection is secure.
-
-
-
Constructor Detail
-
PlainSocketFactory
@Deprecated public PlainSocketFactory(HostNameResolver nameResolver)
Deprecated.(4.1) useDnsResolver
-
PlainSocketFactory
public PlainSocketFactory()
Deprecated.
-
-
Method Detail
-
getSocketFactory
public static PlainSocketFactory getSocketFactory()
Deprecated.Gets the default factory.- Returns:
- the default factory
-
createSocket
public java.net.Socket createSocket(HttpParams params)
Deprecated.Description copied from interface:SchemeSocketFactoryCreates a new, unconnected socket. The socket should subsequently be passed toSchemeSocketFactory.connectSocket(Socket, InetSocketAddress, InetSocketAddress, HttpParams).- Specified by:
createSocketin interfaceSchemeSocketFactory- Parameters:
params- Optional parameters. Parameters passed to this method will have no effect. This method will create a unconnected instance ofSocketclass using default constructor.- Returns:
- a new socket
- Since:
- 4.1
-
createSocket
public java.net.Socket createSocket()
Deprecated.Description copied from interface:SocketFactoryCreates a new, unconnected socket. The socket should subsequently be passed toconnectSocket.- Specified by:
createSocketin interfaceSocketFactory- Returns:
- a new socket
-
connectSocket
public java.net.Socket connectSocket(java.net.Socket socket, java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress, HttpParams params) throws java.io.IOException, ConnectTimeoutExceptionDeprecated.Description copied from interface:SchemeSocketFactoryConnects a socket to the target host with the given remote address.Please note that
HttpInetSocketAddressclass should be used in order to pass the target remote address along with the originalHttpHostvalue used to resolve the address. The use ofHttpInetSocketAddresscan also ensure that no reverse DNS lookup will be performed if the target remote address was specified as an IP address.- Specified by:
connectSocketin interfaceSchemeSocketFactory- Parameters:
socket- the socket to connect, as obtained fromcreateSocket.nullindicates 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, ornullfor anyparams- additionalparametersfor connecting- Returns:
- the connected socket. The returned object may be different
from the
sockargument if this factory supports a layered protocol. - Throws:
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 theparams- Since:
- 4.1
- See Also:
HttpInetSocketAddress
-
isSecure
public final boolean isSecure(java.net.Socket sock)
Deprecated.Checks whether a socket connection is secure. This factory creates plain socket connections which are not considered secure.- Specified by:
isSecurein interfaceSchemeSocketFactory- Specified by:
isSecurein interfaceSocketFactory- Parameters:
sock- the connected socket- Returns:
false
-
connectSocket
@Deprecated public java.net.Socket connectSocket(java.net.Socket socket, java.lang.String host, int port, java.net.InetAddress localAddress, int localPort, HttpParams params) throws java.io.IOException, java.net.UnknownHostException, ConnectTimeoutExceptionDeprecated.Description copied from interface:SocketFactoryConnects a socket to the given host.- Specified by:
connectSocketin interfaceSocketFactory- Parameters:
socket- the socket to connect, as obtained fromcreateSocket.nullindicates 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, ornullfor anylocalPort- the port on the local machine, 0 or a negative number for anyparams- additionalparametersfor connecting- Returns:
- the connected socket. The returned object may be different
from the
sockargument if this factory supports a layered protocol. - Throws:
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 theparams
-
-