title: Using Apache HTTP Components (client) and the examples given just won't work
body: <p>I have tried using the quick given example of:</p>
  
  <pre><code>    HttpClient httpclient = new DefaultHttpClient();
      HttpGet httpget = new HttpGet("http://localhost/");
      HttpResponse response = httpclient.execute(httpget);
      HttpEntity entity = response.getEntity();
      if (entity != null) {
          InputStream instream = entity.getContent();
          try {
              // do something useful
          } finally {
      instream.close();
          }
      }
  </code></pre>
  
  <p><a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html" rel="nofollow">Found here</a>. </p>
  
  <p>But I copy and paste this code across and it throws a few errors. </p>
  
  <ol>
  <li><p>The line:</p>
  
  <pre><code>HttpClient httpclient = new DefaultHttpClient();
  </code></pre>
  
  <p>Throws an error saying that I should change the Default Http Client to a HttpClient. How can I stop this error? You can't cast it, that throws another error but on runtime, whereas the original isn't.</p></li>
  <li><p>The line:</p>
  
  <pre><code>HttpClient httpclient = new DefaultHttpClient();
  </code></pre>
  
  <p>Eclipse claims this line should be changed to <em>'executeMethod()'</em>, again this can be cast but throws a runtime exception, I have never been able to use the <em>'execute'</em> at all since using HTTP components, and it's always thrown this error.</p></li>
  </ol>
  
  <p>Am I missing imports? </p>
  
  <p>Also, if you have any information on how to stream data to and from a server/client, that would be great!</p>
  
  <p>Thanks, </p>
  
  <p>Sam</p>