package com.metamx.http.client;

import com.google.common.base.Throwables;
import com.google.common.util.concurrent.ListenableFuture;

import java.util.concurrent.Future;

/**
 */
public class MockHttpClient extends HttpClient
{
  private volatile GoHandler goHandler;

  public MockHttpClient()
  {
    super(null);
  }

  public GoHandler getGoHandler()
  {
    return goHandler;
  }

  public void setGoHandler(GoHandler goHandler)
  {
    this.goHandler = goHandler;
  }

  public boolean succeeded()
  {
    return goHandler.succeeded();
  }

  @Override
  public <Intermediate, Final> ListenableFuture<Final> go(
      Request<Intermediate, Final> request
  )
  {
    try {
      return goHandler.run(request);
    }
    catch (Exception e) {
      throw Throwables.propagate(e);
    }
  }
}

@@ -131,188 +131,939 @@
 re;%0A
-%0Aimport java.util.concurrent.Future;%0A%0A/**%0A */%0Apublic class MockHttpClient extends HttpClient%0A%7B%0A  private volatile GoHandler goHandler;%0A%0A  public MockHttpClient()%0A  %7B%0A    super(null
+import com.metamx.http.client.pool.ResourceFactory;%0Aimport com.metamx.http.client.pool.ResourcePool;%0Aimport com.metamx.http.client.pool.ResourcePoolConfig;%0Aimport org.jboss.netty.channel.ChannelFuture;%0A%0A/**%0A */%0Apublic class MockHttpClient extends HttpClient%0A%7B%0A  private volatile GoHandler goHandler;%0A%0A  public MockHttpClient()%0A  %7B%0A    super(%0A        new ResourcePool%3CString, ChannelFuture%3E(%0A            new ResourceFactory%3CString, ChannelFuture%3E()%0A            %7B%0A              @Override%0A              public ChannelFuture generate(String key)%0A              %7B%0A                return null;%0A              %7D%0A%0A              @Override%0A              public boolean isGood(ChannelFuture resource)%0A              %7B%0A                return false;%0A              %7D%0A%0A              @Override%0A              public void close(ChannelFuture resource)%0A              %7B%0A%0A              %7D%0A            %7D,%0A            new ResourcePoolConfig(1)%0A        )%0A    
 );%0A 

Update MockHttpClient to use a dummy pool instead of a null pool.