BOSHException abortWithError(BOSHException e) {
            if(e == null)
                throw new IllegalArgumentException("e must not be null");

            // Cancel the request.
            InternalHTTPConnection<InternalHTTPResponse> connectionToCancel = null;
            synchronized(HTTPSenderInternal.this) {
                // Stop if we're already cancelled.
                if(toThrow != null)
                    return toThrow;
                toThrow = e;

                // LOG.log(Level.WARNING, "HTTPSender abortWithError " + (connection != null? "set":"null"));
                connectionToCancel = connection;
                connection = null;
            }

            // Shut down the connection.  This will send requestAborted to any
            // other pipelined requests on this connection.  XXX: test
            if(connectionToCancel != null)
                connectionToCancel.abort();

            requestCompleted(connectionToCancel, false);
            // LOG.log(Level.WARNING, "HTTPSender abortWithError done");
            return toThrow;
        }