title: Implementing asynchronous call using FutureTask and callback
body: <p>So right now, I am trying to implement an asynchronous call which calls my BasicHttpClient to get Http response from the internet, when the Http client done its work, it calls one of Callee class's methods.</p>
  
  <p>Generally, my implementation looks like this.</p>
  
  <pre><code>public class BasicHttpClientAsync {
      private OnRequestFinishedListener mListener;
  
      public interface OnRequestFinishedListener {
          public void onRequestFinished(HttpResponse httpResponse);
  
          public void onRequestFinished(ClientProtocolException e);
  
          public void onRequestFinished(IOException e);
      }
  
      public BasicHttpClient(OnRequestFinishedListener listener) {
          this.mListener = listener;
      }
  
      private Runnable task = new Runnable() {
          @override
          public void run() {
              HttpClient httpClient = new DefaultHttpClient();
              HttpGet httpGet = new HttpGet(URL);
              HttpResponse httpResponse = httpClient.execute(httpGet);
  
              mListener.onRequestFinished(httpResponse);
          }
      };
  
      public void getResponse() {
          ExecutorService executor = Executors.newSingleThreadExecutor();
          FuturkTask&lt;?&gt; futureTask = new FutureTask&lt;Object&gt;(task, null);
          executor.execute(futureTask);
      }
  }
  
  public class Callee implements OnRequestFinishedListener {
      public void getResult() {
          BasicHttpClientAsync httpClient = new BasicHttpClientAsync(this);
          httpClient.getResponse();
      }
  
      @override
      public void onRequestFinished(HttpResponse httpResponse) {
          System.out.println(httpResponse.toString());
      }
  }
  </code></pre>
  
  <p>The code has been largely simplified, and main() method calls Callee class's getResult() method. btw all of the exceptions has been handled, and send back to callee using callback.</p>
  
  <p>However, the "onRequestFinished" in the Callee class seems like never get called.</p>
  
  <p>Help please.</p>