title: Simple java HttpClient program not working
body: <p>I have HttpClient 4.1. Please have a look at following program:</p>
  
  <pre><code>import org.apache.http.client.methods.*;
  import org.apache.http.HttpResponse;
  import org.apache.http.client.HttpClient;
  import org.apache.http.impl.client.DefaultHttpClient;
  
  public class SysCommands {
      public static void main(String [] args){
          try{
              HttpClient c = new DefaultHttpClient();
              System.out.println("Initial part");
              HttpGet method = new HttpGet("http://www.google.com");
              HttpResponse resp = c.execute(method);
              System.out.println("Method executed");
              String s = "";
              resp.getHeaders(s);
              System.out.println("headers are "+s);
              BufferedReader rd = new BufferedReader(new InputStreamReader(resp.getEntity().getContent()));
              String line = "";
              while ((line = rd.readLine()) != null) {
                      System.out.println(line);
              }
          }catch(Exception e){
              System.out.println(e);
          }
      }
  }
  </code></pre>
  
  <p>When I run this, I get <code>org.apache.http.client.ClientProtocolException</code>. What could be wrong?</p>