common/src/main/java/HTTPClient/StreamDemultiplexor.java
/**
     * Emergency stop. Closes the socket and notifies the responses that
     * the requests are aborted.
     *
     * @since V0.3
     */
Emergency stop. Closes the socket and notifies the responses that
the requests are aborted.


Emergency stop . Closes the socket and notifies the responses that the requests are aborted .
void abort()
    {
	Log.write(Log.DEMUX, "Demux: Aborting socket (" + this.hashCode() + ")");
	synchronized (RespHandlerList)
	{
	    for (ResponseHandler resph =
				(ResponseHandler) RespHandlerList.enumerate();
		 resph != null;
		 resph = (ResponseHandler) RespHandlerList.next())
	    {
		if (resph.resp.http_resp != null)
		    resph.resp.http_resp.markAborted();
		if (resph.exception == null)
		    resph.exception = new IOException("Request aborted by user");
	    }
	    /* Close the socket.
	     * Note: this duplicates most of close(IOException, boolean). We
	     * do *not* call close() because that is synchronized, but we want
	     * abort() to be asynch.
	     */
	    if (Sock != null)
	    {
		try
		{
		    try
			{ Sock.setSoLinger(false, 0); }
		    catch (SocketException se)
			{ }
		    try
			{ Stream.close(); }
		    catch (IOException ioe) { }
		    try
			{ Sock.close(); }
		    catch (IOException ioe) { }
		    Sock = null;
		    if (Timer != null)
		    {
			Timer.kill();
			Timer = null;
		    }
		}
		catch (NullPointerException npe)
		    { }
		Connection.DemuxList.remove(this);
	    }
	}
    }
void abort ( ) { Log . write ( Log . DEMUX , "Demux: Aborting socket (" + this . hashCode ( ) + ")" ) ; synchronized ( RespHandlerList ) { for ( ResponseHandler resph = ( ResponseHandler ) RespHandlerList . enumerate ( ) ; resph != null ; resph = ( ResponseHandler ) RespHandlerList . next ( ) ) { if ( resph . resp . http_resp != null ) resph . resp . http_resp . markAborted ( ) ; if ( resph . exception == null ) resph . exception = new IOException ( "Request aborted by user" ) ; } /* Close the socket.
	     * Note: this duplicates most of close(IOException, boolean). We
	     * do *not* call close() because that is synchronized, but we want
	     * abort() to be asynch.
	     */ if ( Sock != null ) { try { try { Sock . setSoLinger ( false , 0 ) ; } catch ( SocketException se ) { } try { Stream . close ( ) ; } catch ( IOException ioe ) { } try { Sock . close ( ) ; } catch ( IOException ioe ) { } Sock = null ; if ( Timer != null ) { Timer . kill ( ) ; Timer = null ; } } catch ( NullPointerException npe ) { } Connection . DemuxList . remove ( this ) ; } } }
Emergency stop.
Emergency stop .
// notify all responses of abort