package net.i2p.client.streaming;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

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.
 */
public interface I2PSocket {
    /**
     * Return the Destination of this side of the socket.
     */
    public Destination getThisDestination();

    /**
     * Return the destination of the peer.
     */
    public Destination getPeerDestination();

    /**
     * Return an InputStream to read from the socket.
     */
    public InputStream getInputStream() throws IOException;

    /**
     * Return an OutputStream to write into the socket.
     */
    public OutputStream getOutputStream() throws IOException;

    /**
     * How long we will wait blocked on a read() operation.
     *
     * @return milliseconds to wait, or -1 if we will wait indefinitely
     */
    public long getReadTimeout();

    /**
     * Define how long we will wait blocked on a read() operation (-1 will make
     * the socket wait forever).
     *
     */
    public void setReadTimeout(long ms);

    /**
     * Closes the socket if not closed yet
     */
    public void close() throws IOException;
}

@@ -1324,10 +1324,750 @@
 eption;%0A
+    %0A    public void setSocketErrorListener(SocketErrorListener lsnr);%0A    /**%0A     * Allow notification of underlying errors communicating across I2P without%0A     * waiting for any sort of cleanup process.  For example, if some data could%0A     * not be sent, this listener is notified immediately, and while the input/output%0A     * streams are notified through IOExceptions, they are told only after the %0A     * TCP-like stream is closed (which may be a minute later, if the close message%0A     * times out as well).  This is not fired on normal close() activity.%0A     *%0A     */%0A    public interface SocketErrorListener %7B%0A        /**%0A         * An error occurred communicating with the peer.%0A         */%0A        void errorOccurred();%0A    %7D%0A
 %7D%0A

add the socketErrorListener interface (sorry duck)