DefaultBHttpClientConnection
@Deprecated public class SocketHttpClientConnection extends AbstractHttpClientConnection implements HttpInetConnection
Socket
for receiving data from and transmitting data to
a remote server.Constructor and Description |
---|
SocketHttpClientConnection()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assertNotOpen()
Deprecated.
|
protected void |
assertOpen()
Deprecated.
Asserts if the connection is open.
|
protected void |
bind(Socket socket,
HttpParams params)
Deprecated.
Binds this connection to the given
Socket . |
void |
close()
Deprecated.
Closes this connection gracefully.
|
protected SessionInputBuffer |
createSessionInputBuffer(Socket socket,
int buffersize,
HttpParams params)
Deprecated.
Creates an instance of
SocketInputBuffer to be used for
receiving data from the given Socket . |
protected SessionOutputBuffer |
createSessionOutputBuffer(Socket socket,
int buffersize,
HttpParams params)
Deprecated.
Creates an instance of
SessionOutputBuffer to be used for
sending data to the given Socket . |
InetAddress |
getLocalAddress()
Deprecated.
|
int |
getLocalPort()
Deprecated.
|
InetAddress |
getRemoteAddress()
Deprecated.
|
int |
getRemotePort()
Deprecated.
|
protected Socket |
getSocket()
Deprecated.
|
int |
getSocketTimeout()
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.
|
String |
toString()
Deprecated.
|
createConnectionMetrics, createEntityDeserializer, createEntitySerializer, createHttpResponseFactory, createRequestWriter, createResponseParser, doFlush, flush, getMetrics, init, isEof, isResponseAvailable, isStale, receiveResponseEntity, receiveResponseHeader, sendRequestEntity, sendRequestHeader
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getMetrics, isStale
protected void assertNotOpen()
protected void assertOpen()
AbstractHttpClientConnection
assertOpen
in class AbstractHttpClientConnection
protected SessionInputBuffer createSessionInputBuffer(Socket socket, int buffersize, HttpParams params) throws IOException
SocketInputBuffer
to be used for
receiving data from the given Socket
.
This method can be overridden in a super class in order to provide
a custom implementation of SessionInputBuffer
interface.
socket
- the socket.buffersize
- the buffer size.params
- HTTP parameters.IOException
- in case of an I/O error.SocketInputBuffer.SocketInputBuffer(Socket, int, HttpParams)
protected SessionOutputBuffer createSessionOutputBuffer(Socket socket, int buffersize, HttpParams params) throws IOException
SessionOutputBuffer
to be used for
sending data to the given Socket
.
This method can be overridden in a super class in order to provide
a custom implementation of SocketOutputBuffer
interface.
socket
- the socket.buffersize
- the buffer size.params
- HTTP parameters.IOException
- in case of an I/O error.SocketOutputBuffer.SocketOutputBuffer(Socket, int, HttpParams)
protected void bind(Socket socket, HttpParams params) throws IOException
Socket
. This socket will be
used by the connection to send and receive data.
This method will invoke createSessionInputBuffer(Socket, int, HttpParams)
and createSessionOutputBuffer(Socket, int, HttpParams)
methods
to create session input / output buffers bound to this socket and then
will invoke AbstractHttpClientConnection.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 return true
.
socket
- the socket.params
- HTTP parameters.IOException
- in case of an I/O error.public boolean isOpen()
HttpConnection
isOpen
in interface HttpConnection
protected Socket getSocket()
public InetAddress getLocalAddress()
getLocalAddress
in interface HttpInetConnection
public int getLocalPort()
getLocalPort
in interface HttpInetConnection
public InetAddress getRemoteAddress()
getRemoteAddress
in interface HttpInetConnection
public int getRemotePort()
getRemotePort
in interface HttpInetConnection
public void setSocketTimeout(int timeout)
HttpConnection
setSocketTimeout
in interface HttpConnection
timeout
- timeout value in millisecondspublic int getSocketTimeout()
HttpConnection
getSocketTimeout
in interface HttpConnection
0
if timeout is disabled or -1
if
timeout is undefined.public void shutdown() throws IOException
HttpConnection
shutdown
in interface HttpConnection
IOException
public void close() throws IOException
HttpConnection
shutdown
instead.close
in interface Closeable
close
in interface AutoCloseable
close
in interface HttpConnection
IOException
Copyright © 2005–2017 The Apache Software Foundation. All rights reserved.