private static boolean finishLastResponse ( final HttpConnection conn ) { InputStream lastResponse = conn . getLastResponseInputStream ( ) ; if ( lastResponse != null ) { conn . setLastResponseInputStream ( null ) ; try { lastResponse . close ( ) ; return true ; } catch ( IOException ioe ) { // force reconnect. return false ; } } else { return false ; } }
Since the same connection is about to be reused make sure the previous request was completely processed and if not consume it now .