common/src/main/java/HTTPClient/StreamDemultiplexor.java
/**
     * Closes the socket and all associated streams. If <var>exception</var>
     * is not null then all active requests are retried.
     *
     * <P>There are five ways this method may be activated. 1) if an exception
     * occurs during read or write. 2) if the stream is marked for close but
     * no responses are outstanding (e.g. due to a timeout). 3) when the
     * markedForClose response is closed. 4) if all response streams up until
     * and including the markedForClose response have been closed. 5) if this
     * demux is finalized.
     *
     * @param exception the IOException to be sent to the streams.
     * @param was_reset if true then the exception is due to a connection
     *                  reset; otherwise it means we generated the exception
     *                  ourselves and this is a "normal" close.
     */
Closes the socket and all associated streams. If exception
is not null then all active requests are retried.

There are five ways this method may be activated. 1) if an exception
occurs during read or write. 2) if the stream is marked for close but
no responses are outstanding . 3) when the
markedForClose response is closed. 4) if all response streams up until
and including the markedForClose response have been closed. 5) if this
demux is finalized.

@param exception the IOException to be sent to the streams.
@param was_reset if true then the exception is due to a connection
reset; otherwise it means we generated the exception
ourselves and this is a "normal" close.
Closes the socket and all associated streams . If exception is not null then all active requests are retried . There are five ways this method may be activated . 1 ) if an exception occurs during read or write . 2 ) if the stream is marked for close but no responses are outstanding . 3 ) when the markedForClose response is closed . 4 ) if all response streams up until and including the markedForClose response have been closed . 5 ) if this demux is finalized . @param exception the IOException to be sent to the streams . @param was_reset if true then the exception is due to a connection reset ; otherwise it means we generated the exception ourselves and this is a " normal " close .
synchronized void close(IOException exception, boolean was_reset)
    {
	if (Sock == null)	
	    return;
	Log.write(Log.DEMUX, "Demux: Closing all streams and socket (" +
			     this.hashCode() + ")");
	try
	    { Stream.close(); }
	catch (IOException ioe) { }
	try
	    { Sock.close(); }
	catch (IOException ioe) { }
	Sock = null;
	if (Timer != null)
	{
	    Timer.kill();
	    Timer = null;
	}
	Connection.DemuxList.remove(this);
	if (exception != null)
	    synchronized (RespHandlerList)
		{ retry_requests(exception, was_reset); }
    }
synchronized void close ( IOException exception , boolean was_reset ) { if ( Sock == null ) return ; Log . write ( Log . DEMUX , "Demux: Closing all streams and socket (" + this . hashCode ( ) + ")" ) ; try { Stream . close ( ) ; } catch ( IOException ioe ) { } try { Sock . close ( ) ; } catch ( IOException ioe ) { } Sock = null ; if ( Timer != null ) { Timer . kill ( ) ; Timer = null ; } Connection . DemuxList . remove ( this ) ; if ( exception != null ) synchronized ( RespHandlerList ) { retry_requests ( exception , was_reset ) ; } }
Closes the socket and all associated streams.
Closes the socket and all associated streams .
// already cleaned up // Here comes the tricky part: redo outstanding requests!