private static boolean discardStream(HttpEngine httpEngine,InputStream responseBodyIn){
  Connection connection=httpEngine.connection;
  if (connection == null)   return false;
  Socket socket=connection.getSocket();
  if (socket == null)   return false;
  try {
    int socketTimeout=socket.getSoTimeout();
    socket.setSoTimeout(DISCARD_STREAM_TIMEOUT_MILLIS);
    try {
      Util.skipAll(responseBodyIn);
      return true;
    }
  finally {
      socket.setSoTimeout(socketTimeout);
    }
  }
 catch (  IOException e) {
    return false;
  }
}

private static boolean discardStream ( HttpEngine httpEngine , InputStream responseBodyIn ) { Connection connection = httpEngine . connection ; if ( connection == null ) return false ; Socket socket = connection . getSocket ( ) ; if ( socket == null ) return false ; try { int socketTimeout = socket . getSoTimeout ( ) ; socket . setSoTimeout ( DISCARD_STREAM_TIMEOUT_MILLIS ) ; try { Util . skipAll ( responseBodyIn ) ; return true ; } finally { socket . setSoTimeout ( socketTimeout ) ; } } catch ( IOException e ) { return false ; } }
discards the response body so that the connection can be reused . this needs to be done judiciously , since it delays the current request in order to speed up a potential future request that may never occur . < p / > < p > a stream may be discarded to encourage response caching ( a response cannot be cached unless it is consumed completely ) or to enable connection reuse .
