title: Http connection timeout on Android not working
body: <p>I'm writing an application that connects to a webservice and I don't want it to wait too long if it can't get a connection. I therefore set the connectionTimeout of the httpparams. But it doesn't seem to have any effect whatsoever.</p>
  
  <p>To test I turn of my WLAN temporarily. The application tries to connect for quite some time (way more than the 3 seconds I want) and then throws an UnknownHostException.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>try{
      HttpClient httpclient = new DefaultHttpClient();
      HttpParams params = httpclient.getParams();
      HttpConnectionParams.setConnectionTimeout(params, 3000);
      HttpConnectionParams.setSoTimeout(params, 3000);
  
      httppost = new HttpPost(URL);
      StringEntity se = new StringEntity(envelope,HTTP.UTF_8);
      httppost.setEntity(se);
      //Code stops here until UnknownHostException is thrown.
      BasicHttpResponse httpResponse = (BasicHttpResponse) httpclient.execute(httppost);
  
      HttpEntity entity = httpResponse.getEntity();
      return entity;
  
  }catch (Exception e){
      e.printStackTrace();
  }
  </code></pre>
  
  <p>Anyone have any ideas what I missed?</p>