--- org/apache/commons/httpclient/HttpConnection.java 2007-08-18 02:02:15.000000000 -0700 +++ org/apache/commons/httpclient/HttpConnection.java 2011-04-06 15:44:54.000000000 -0700 @@ -1219,6 +1219,17 @@ // no longer care about previous responses... lastResponseInputStream = null; + if (null != socket) { + Socket temp = socket; + socket = null; + try { + temp.close(); + } catch (Exception ex) { + LOG.debug("Exception caught when closing socket", ex); + // ignored + } + } + if (null != outputStream) { OutputStream temp = outputStream; outputStream = null; @@ -1240,17 +1251,6 @@ // ignored } } - - if (null != socket) { - Socket temp = socket; - socket = null; - try { - temp.close(); - } catch (Exception ex) { - LOG.debug("Exception caught when closing socket", ex); - // ignored - } - } tunnelEstablished = false; usingSecureSocket = false;