java.lang.Object
org.apache.http.mockup.HttpConnectionMockup
- All Implemented Interfaces:
- org.apache.http.HttpConnection
- public class HttpConnectionMockup
- extends java.lang.Object
- implements org.apache.http.HttpConnection
org.apache.http.HttpConnection mockup implementation.
|
Field Summary |
private boolean |
open
|
|
Method Summary |
void |
close()
This method will gracefully close the connection. |
int |
getSocketTimeout()
|
boolean |
isOpen()
Checks if this connection is open. |
boolean |
isStale()
Network connections may get closed during some time of inactivity for several reasons. |
void |
setSocketTimeout(int timeout)
|
void |
shutdown()
This method will force close the connection. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
open
private boolean open
HttpConnectionMockup
public HttpConnectionMockup()
close
public void close()
throws java.io.IOException
- Description copied from interface:
org.apache.http.HttpConnection
- This method will gracefully close the connection. It will attempt to
flush the transmitter's internal buffer prior to closing the underlying
socket. This method MAY NOT be called from a different thread to force
shutdown the connection. Use #shutdown() instead.
- Specified by:
close in interface org.apache.http.HttpConnection
shutdown
public void shutdown()
throws java.io.IOException
- Description copied from interface:
org.apache.http.HttpConnection
- This method will force close the connection. This is the only method,
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 interface org.apache.http.HttpConnection
getSocketTimeout
public int getSocketTimeout()
throws java.io.IOException
isOpen
public boolean isOpen()
- Description copied from interface:
org.apache.http.HttpConnection
- Checks if this connection is open.
- Specified by:
isOpen in interface org.apache.http.HttpConnection
isStale
public boolean isStale()
- Description copied from interface:
org.apache.http.HttpConnection
- Network connections may get closed during some time of inactivity for several reasons.
The next time a read is attempted on such a connection it will throw an IOException.
This method tries to alleviate this inconvenience by trying to find out if a connection is still
usable. Implementations may do that by attempting a read with a very small timeout. Thus this
method may block for a small indefinite time before returning a result.
- Specified by:
isStale in interface org.apache.http.HttpConnection
setSocketTimeout
public void setSocketTimeout(int timeout)
throws java.io.IOException