Class SocketHttpClientConnection
- java.lang.Object
-
- org.apache.http.impl.AbstractHttpClientConnection
-
- org.apache.http.impl.SocketHttpClientConnection
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,HttpClientConnection,HttpConnection,HttpInetConnection
- Direct Known Subclasses:
DefaultHttpClientConnection
@Deprecated public class SocketHttpClientConnection extends AbstractHttpClientConnection implements HttpInetConnection
Deprecated.(4.3) useDefaultBHttpClientConnectionImplementation of a client-side HTTP connection that can be bound to an arbitrarySocketfor receiving data from and transmitting data to a remote server.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description SocketHttpClientConnection()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidassertNotOpen()Deprecated.protected voidassertOpen()Deprecated.Asserts if the connection is open.protected voidbind(java.net.Socket socket, HttpParams params)Deprecated.Binds this connection to the givenSocket.voidclose()Deprecated.Closes this connection gracefully.protected SessionInputBuffercreateSessionInputBuffer(java.net.Socket socket, int bufferSize, HttpParams params)Deprecated.Creates an instance ofSocketInputBufferto be used for receiving data from the givenSocket.protected SessionOutputBuffercreateSessionOutputBuffer(java.net.Socket socket, int bufferSize, HttpParams params)Deprecated.Creates an instance ofSessionOutputBufferto be used for sending data to the givenSocket.java.net.InetAddressgetLocalAddress()Deprecated.intgetLocalPort()Deprecated.java.net.InetAddressgetRemoteAddress()Deprecated.intgetRemotePort()Deprecated.protected java.net.SocketgetSocket()Deprecated.intgetSocketTimeout()Deprecated.Returns the socket timeout value.booleanisOpen()Deprecated.Checks if this connection is open.voidsetSocketTimeout(int timeout)Deprecated.Sets the socket timeout value.voidshutdown()Deprecated.Force-closes this connection.java.lang.StringtoString()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
-
-
-
-
Method Detail
-
assertNotOpen
protected void assertNotOpen()
Deprecated.
-
assertOpen
protected void assertOpen()
Deprecated.Description copied from class:AbstractHttpClientConnectionAsserts if the connection is open.- Specified by:
assertOpenin classAbstractHttpClientConnection
-
createSessionInputBuffer
protected SessionInputBuffer createSessionInputBuffer(java.net.Socket socket, int bufferSize, HttpParams params) throws java.io.IOException
Deprecated.Creates an instance ofSocketInputBufferto 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
SessionInputBufferinterface.- Parameters:
socket- the socket.bufferSize- the buffer size.params- HTTP parameters.- Returns:
- session input buffer.
- Throws:
java.io.IOException- in case of an I/O error.- See Also:
SocketInputBuffer(Socket, int, HttpParams)
-
createSessionOutputBuffer
protected SessionOutputBuffer createSessionOutputBuffer(java.net.Socket socket, int bufferSize, HttpParams params) throws java.io.IOException
Deprecated.Creates an instance ofSessionOutputBufferto 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
SocketOutputBufferinterface.- Parameters:
socket- the socket.bufferSize- the buffer size.params- HTTP parameters.- Returns:
- session output buffer.
- Throws:
java.io.IOException- in case of an I/O error.- See Also:
SocketOutputBuffer(Socket, int, HttpParams)
-
bind
protected void bind(java.net.Socket socket, HttpParams params) throws java.io.IOExceptionDeprecated.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:
java.io.IOException- in case of an I/O error.
-
isOpen
public boolean isOpen()
Deprecated.Description copied from interface:HttpConnectionChecks if this connection is open.- Specified by:
isOpenin interfaceHttpConnection- Returns:
- true if it is open, false if it is closed.
-
getSocket
protected java.net.Socket getSocket()
Deprecated.
-
getLocalAddress
public java.net.InetAddress getLocalAddress()
Deprecated.- Specified by:
getLocalAddressin interfaceHttpInetConnection
-
getLocalPort
public int getLocalPort()
Deprecated.- Specified by:
getLocalPortin interfaceHttpInetConnection
-
getRemoteAddress
public java.net.InetAddress getRemoteAddress()
Deprecated.- Specified by:
getRemoteAddressin interfaceHttpInetConnection
-
getRemotePort
public int getRemotePort()
Deprecated.- Specified by:
getRemotePortin interfaceHttpInetConnection
-
setSocketTimeout
public void setSocketTimeout(int timeout)
Deprecated.Description copied from interface:HttpConnectionSets the socket timeout value.- Specified by:
setSocketTimeoutin interfaceHttpConnection- Parameters:
timeout- timeout value in milliseconds
-
getSocketTimeout
public int getSocketTimeout()
Deprecated.Description copied from interface:HttpConnectionReturns the socket timeout value.- Specified by:
getSocketTimeoutin interfaceHttpConnection- Returns:
- positive value in milliseconds if a timeout is set,
0if timeout is disabled or-1if timeout is undefined.
-
shutdown
public void shutdown() throws java.io.IOExceptionDeprecated.Description copied from interface:HttpConnectionForce-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:
shutdownin interfaceHttpConnection- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionDeprecated.Description copied from interface:HttpConnectionCloses 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. Useshutdowninstead.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceHttpConnection- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toStringin classjava.lang.Object
-
-