Code example for DefaultHttpClient

0
 
@Implements(AndroidHttpClient.class)
public class ShadowAndroidHttpClient { 
  @RealObject private AndroidHttpClient client;
 
  private HttpClient httpClient = new DefaultHttpClient();
 
  @Implementation 
  public static AndroidHttpClient newInstance(String userAgent) {
    return Robolectric.newInstanceOf(AndroidHttpClient.class);
  } 
 
  @Implementation 
  public static AndroidHttpClient newInstance(String userAgent, Context context) {
    return Robolectric.newInstanceOf(AndroidHttpClient.class);
  } 
 
  @Implementation 
  public HttpParams getParams() {
    return httpClient.getParams();
  }