반응형
HttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter("http.protocol.expect-continue", false);
httpclient.getParams().setParameter("http.connection.timeout", 5000);
httpclient.getParams().setParameter("http.socket.timeout", 5000);
또 다른 방법은 HttpConnectionParams 클래스에서 지원하는
setConnectionTimeout과 setSoTimeout을 이용 timeout 을 설정.
HttpClient httpclient = new DefaultHttpClient();
HttpParams params = httpclient.getParams();
HttpConnectionParams.setConnectionTimeout(params, 5000);
HttpConnectionParams.setSoTimeout(params, 5000);
반응형