Top Description Fields Constructors Methods
org.apache.http.conn.socket

public Class PlainConnectionSocketFactory

extends Object
implements ConnectionSocketFactory
Class Inheritance
All Implemented Interfaces
org.apache.http.conn.socket.ConnectionSocketFactory
Annotations
@Contract
threading:IMMUTABLE
Imports
java.io.IOException, java.net.InetSocketAddress, .Socket, org.apache.http.HttpHost, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.protocol.HttpContext

The default class for creating plain (unencrypted) sockets.
Since
4.3

Field Summary

Modifier and TypeField and Description
public static final PlainConnectionSocketFactory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Socket
connectSocket(final int
connect timeout.
connectTimeout
,
final Socket
the socket to connect, as obtained from createSocket(HttpContext). null indicates that a new socket should be created and connected.
socket
,
final HttpHost
target host as specified by the caller (end user).
host
,
final InetSocketAddress
the resolved remote address to connect to.
remoteAddress
,
final InetSocketAddress
the local address to bind the socket to, or null for any.
localAddress
,
final HttpContext
the actual HTTP context.
context
)

Implements org.apache.http.conn.socket.ConnectionSocketFactory.connectSocket.

Connects the socket to the target host with the given resolved remote address.
public Socket
createSocket(final HttpContext context)

Implements org.apache.http.conn.socket.ConnectionSocketFactory.createSocket.

Creates new, unconnected socket.
public static PlainConnectionSocketFactory
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final PlainConnectionSocketFactory INSTANCE

Constructor Detail

PlainConnectionSocketFactoryback to summary
public PlainConnectionSocketFactory()

Method Detail

connectSocketback to summary
public Socket connectSocket(final int connectTimeout, final Socket socket, final HttpHost host, final InetSocketAddress remoteAddress, final InetSocketAddress localAddress, final HttpContext context) throws IOException

Implements org.apache.http.conn.socket.ConnectionSocketFactory.connectSocket.

Doc from org.apache.http.conn.socket.ConnectionSocketFactory.connectSocket.

Connects the socket to the target host with the given resolved remote address.

Parameters
connectTimeout:int

connect timeout.

socket:Socket

the socket to connect, as obtained from createSocket(HttpContext). null indicates that a new socket should be created and connected.

host:HttpHost

target host as specified by the caller (end user).

remoteAddress:InetSocketAddress

the resolved remote address to connect to.

localAddress:InetSocketAddress

the local address to bind the socket to, or null for any.

context:HttpContext

the actual HTTP context.

Returns:Socket

the connected socket. The returned object may be different from the sock argument if this factory supports a layered protocol.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
createSocketback to summary
public Socket createSocket(final HttpContext context) throws IOException

Implements org.apache.http.conn.socket.ConnectionSocketFactory.createSocket.

Doc from org.apache.http.conn.socket.ConnectionSocketFactory.createSocket.

Creates new, unconnected socket. The socket should subsequently be passed to connectSocket method.

Returns:Socket

a new socket

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while creating the socket
getSocketFactoryback to summary
public static PlainConnectionSocketFactory getSocketFactory()