Streaming: Throw I2PSocketException when connection is reset,

display new error page in HTTP client (ticket #643)
javadocs
This commit is contained in:
zzz
2015-03-24 14:33:36 +00:00
parent a975dc4427
commit 9e18c7ea18
10 changed files with 112 additions and 16 deletions

View File

@@ -9,9 +9,10 @@ import java.nio.channels.SelectableChannel;
import net.i2p.data.Destination;
/**
* Minimalistic adapter between the socket api and I2PTunnel's way.
* Note that this interface is a "subinterface" of the interface
* defined in the "official" streaming api.
* Streaming socket returned by {@link I2PSocketManager#connect(Destination)}.
*<p>
* Note that this is not a standard Java {@link java.net.Socket},
* if you need one of those, use {@link I2PSocketManager#connectToSocket(Destination)} instead.
*/
public interface I2PSocket extends Closeable {
/**
@@ -27,6 +28,12 @@ public interface I2PSocket extends Closeable {
/**
* As of 0.9.9 will throw an IOE if socket is closed.
* Prior to that would return null instead of throwing IOE.
*<p>
* Note that operations on the returned stream may return an
* {@link IOException} whose <i>cause</i> as returned by
* {@link IOException#getCause()} is an {@link I2PSocketException}.
* If so, the client may retrieve a status code via
* {@link I2PSocketException#getStatus()} to provide specific feedback to the user.
*
* @return an InputStream to read from the socket. Non-null since 0.9.9.
* @throws IOException on failure
@@ -36,6 +43,12 @@ public interface I2PSocket extends Closeable {
/**
* As of 0.9.9 will throw an IOE if socket is closed.
* Prior to that would return null instead of throwing IOE.
*<p>
* Note that operations on the returned stream may return an
* {@link IOException} whose <i>cause</i> as returned by
* {@link IOException#getCause()} is an {@link I2PSocketException}.
* If so, the client may retrieve a status code via
* {@link I2PSocketException#getStatus()} to provide specific feedback to the user.
*
* @return an OutputStream to write into the socket. Non-null since 0.9.9.
* @throws IOException on failure