HttpClient 4 必须设超时时间,否则线程一直等在那.

      

  // Note: must set timeout,otherwise alway wait here.

        // set time out

        // conntction timeout 20s

        httpclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 20000);

        // transfer time 60s

        httpclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 60000);

你可能感兴趣的:(httpclient)