Class SocketHttpClientConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,HttpClientConnection
,HttpConnection
,HttpInetConnection
- Direct Known Subclasses:
DefaultHttpClientConnection
Socket
for receiving data from and transmitting data to
a remote server.- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Deprecated.protected void
Deprecated.Asserts if the connection is open.protected void
bind
(Socket socket, HttpParams params) Deprecated.Binds this connection to the givenSocket
.void
close()
Deprecated.Closes this connection gracefully.protected SessionInputBuffer
createSessionInputBuffer
(Socket socket, int bufferSize, HttpParams params) Deprecated.Creates an instance ofSocketInputBuffer
to be used for receiving data from the givenSocket
.protected SessionOutputBuffer
createSessionOutputBuffer
(Socket socket, int bufferSize, HttpParams params) Deprecated.Creates an instance ofSessionOutputBuffer
to be used for sending data to the givenSocket
.private static void
formatAddress
(StringBuilder buffer, SocketAddress socketAddress) Deprecated.Deprecated.int
Deprecated.Deprecated.int
Deprecated.protected Socket
Deprecated.int
Deprecated.Returns the socket timeout value.boolean
isOpen()
Deprecated.Checks if this connection is open.void
setSocketTimeout
(int timeout) Deprecated.Sets the socket timeout value.void
shutdown()
Deprecated.Force-closes this connection.toString()
Deprecated.Methods inherited from class org.apache.http.impl.AbstractHttpClientConnection
createConnectionMetrics, createEntityDeserializer, createEntitySerializer, createHttpResponseFactory, createRequestWriter, createResponseParser, doFlush, flush, getMetrics, init, isEof, isResponseAvailable, isStale, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.http.HttpConnection
getMetrics, isStale
-
Field Details
-
open
private volatile boolean openDeprecated. -
socket
Deprecated.
-
-
Constructor Details
-
SocketHttpClientConnection
public SocketHttpClientConnection()Deprecated.
-
-
Method Details
-
assertNotOpen
protected void assertNotOpen()Deprecated. -
assertOpen
protected void assertOpen()Deprecated.Description copied from class:AbstractHttpClientConnection
Asserts if the connection is open.- Specified by:
assertOpen
in classAbstractHttpClientConnection
-
createSessionInputBuffer
protected SessionInputBuffer createSessionInputBuffer(Socket socket, int bufferSize, HttpParams params) throws IOException Deprecated.Creates an instance ofSocketInputBuffer
to be used for receiving data from the givenSocket
.This method can be overridden in a super class in order to provide a custom implementation of
SessionInputBuffer
interface.- Parameters:
socket
- the socket.bufferSize
- the buffer size.params
- HTTP parameters.- Returns:
- session input buffer.
- Throws:
IOException
- in case of an I/O error.- See Also:
-
createSessionOutputBuffer
protected SessionOutputBuffer createSessionOutputBuffer(Socket socket, int bufferSize, HttpParams params) throws IOException Deprecated.Creates an instance ofSessionOutputBuffer
to be used for sending data to the givenSocket
.This method can be overridden in a super class in order to provide a custom implementation of
SocketOutputBuffer
interface.- Parameters:
socket
- the socket.bufferSize
- the buffer size.params
- HTTP parameters.- Returns:
- session output buffer.
- Throws:
IOException
- in case of an I/O error.- See Also:
-
bind
Deprecated.Binds this connection to the givenSocket
. This socket will be used by the connection to send and receive data.This method will invoke
createSessionInputBuffer(Socket, int, HttpParams)
andcreateSessionOutputBuffer(Socket, int, HttpParams)
methods to create session input / output buffers bound to this socket and then will invokeAbstractHttpClientConnection.init(SessionInputBuffer, SessionOutputBuffer, HttpParams)
method to pass references to those buffers to the underlying HTTP message parser and formatter.After this method's execution the connection status will be reported as open and the
isOpen()
will returntrue
.- Parameters:
socket
- the socket.params
- HTTP parameters.- Throws:
IOException
- in case of an I/O error.
-
isOpen
public boolean isOpen()Deprecated.Description copied from interface:HttpConnection
Checks if this connection is open.- Specified by:
isOpen
in interfaceHttpConnection
- Returns:
- true if it is open, false if it is closed.
-
getSocket
Deprecated. -
getLocalAddress
Deprecated.- Specified by:
getLocalAddress
in interfaceHttpInetConnection
-
getLocalPort
public int getLocalPort()Deprecated.- Specified by:
getLocalPort
in interfaceHttpInetConnection
-
getRemoteAddress
Deprecated.- Specified by:
getRemoteAddress
in interfaceHttpInetConnection
-
getRemotePort
public int getRemotePort()Deprecated.- Specified by:
getRemotePort
in interfaceHttpInetConnection
-
setSocketTimeout
public void setSocketTimeout(int timeout) Deprecated.Description copied from interface:HttpConnection
Sets the socket timeout value.- Specified by:
setSocketTimeout
in interfaceHttpConnection
- Parameters:
timeout
- timeout value in milliseconds
-
getSocketTimeout
public int getSocketTimeout()Deprecated.Description copied from interface:HttpConnection
Returns the socket timeout value.- Specified by:
getSocketTimeout
in interfaceHttpConnection
- Returns:
- positive value in milliseconds if a timeout is set,
0
if timeout is disabled or-1
if timeout is undefined.
-
shutdown
Deprecated.Description copied from interface:HttpConnection
Force-closes this connection. This is the only method of a connection which may be called from a different thread to terminate the connection. This method will not attempt to flush the transmitter's internal buffer prior to closing the underlying socket.- Specified by:
shutdown
in interfaceHttpConnection
- Throws:
IOException
-
close
Deprecated.Description copied from interface:HttpConnection
Closes this connection gracefully. This method will attempt to flush the internal output buffer prior to closing the underlying socket. This method MUST NOT be called from a different thread to force shutdown of the connection. Useshutdown
instead.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceHttpConnection
- Throws:
IOException
-
formatAddress
Deprecated. -
toString
Deprecated.
-
DefaultBHttpClientConnection