Search in sources :

Example 6 with HttpClient

use of org.pixmob.httpclient.HttpClient in project httpclient by pixmob.

the class Task method createClient.

protected HttpClient createClient() {
    final HttpClient hc = new HttpClient(context);
    hc.setConnectTimeout(4000);
    hc.setReadTimeout(8000);
    return hc;
}
Also used : HttpClient(org.pixmob.httpclient.HttpClient)

Example 7 with HttpClient

use of org.pixmob.httpclient.HttpClient in project httpclient by pixmob.

the class HttpsTask method doRun.

@Override
protected void doRun() throws Exception {
    final String[] httpsUrls = { "https://www.google.com", "https://www.facebook.com", "https://twitter.com", "https://mobile.free.fr/moncompte/" };
    final HttpClient hc = createClient();
    for (final String url : httpsUrls) {
        hc.get(url).expect(HttpURLConnection.HTTP_OK, HttpURLConnection.HTTP_MOVED_TEMP, HttpURLConnection.HTTP_MOVED_PERM).execute();
    }
}
Also used : HttpClient(org.pixmob.httpclient.HttpClient)

Aggregations

HttpClient (org.pixmob.httpclient.HttpClient)7 HttpResponse (org.pixmob.httpclient.HttpResponse)2 Account (android.accounts.Account)1 AccountManager (android.accounts.AccountManager)1 File (java.io.File)1 JSONObject (org.json.JSONObject)1 GoogleAppEngineAuthenticator (org.pixmob.httpclient.GoogleAppEngineAuthenticator)1 HttpResponseHandler (org.pixmob.httpclient.HttpResponseHandler)1 TaskExecutionFailedException (org.pixmob.httpclient.demo.TaskExecutionFailedException)1