在舊庫4.0,你會簡單地做:如何處理httpclient 4.3+中的超時?
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpParams params = httpClient.getParams();
HttpConnectionParams.setConnectionTimeout(httpParams, connectionTimeoutMillis);
HttpConnectionParams.setSoTimeout(httpParams, socketTimeoutMillis);
但現在DefaultHttpClient已被棄用,爲了創造你所要做的的HttpClient:
HttpClients.createDefault();
這是好的,但不允許我爲請求設置超時。那麼,是否有解決方法/方法而不返回到棄用的類?