boolean error = false;
while (true) {
synchronized (this) {
while (!running) {
try {
this.wait();
} catch (InterruptedException e) { /* ignored */ }
}
}
AndroidHttpClient client = AndroidHttpClient.newInstance(
"Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101");
try {
// Cert. is for "www.google.com", not "google.com".
String url = error ? "https://google.com/"
: "https://www.google.com";
client.execute(new HttpGet(url),
new ResponseHandler<Void>() {
public Void handleResponse(HttpResponse response) {
/* ignore */
return null;
}
});
Log.i(TAG, "Request succeeded.");
} catch (IOException e) {
Log.w(TAG, "Request failed.", e);
}
client.close();
try {
Thread.sleep(1000);
} catch (InterruptedException e) { /* ignored */ }
error = !error;
}