Package com.metamx.http.client

Examples of com.metamx.http.client.RequestBuilder


{
  @Test
  public void testRun() throws Exception
  {
    HttpClient httpClient = EasyMock.createMock(HttpClient.class);
    RequestBuilder requestBuilder = new RequestBuilder(httpClient, HttpMethod.POST, new URL("http://foo.com"));
    EasyMock.expect(httpClient.post(EasyMock.<URL>anyObject())).andReturn(requestBuilder).atLeastOnce();

    SettableFuture futureException = SettableFuture.create();

    SettableFuture<InputStream> futureResult = SettableFuture.create();
View Full Code Here


  @Test
  public void testCancel() throws Exception
  {
    HttpClient httpClient = EasyMock.createStrictMock(HttpClient.class);
        EasyMock.expect(httpClient.post(EasyMock.<URL>anyObject())).andReturn(
            new RequestBuilder(httpClient, HttpMethod.POST, new URL("http://foo.com"))
        ).once();

    ListenableFuture<Object> cancelledFuture = Futures.immediateCancelledFuture();
    EasyMock.expect(httpClient.go(EasyMock.<Request>anyObject())).andReturn(cancelledFuture).once();

    EasyMock.expect(httpClient.delete(EasyMock.<URL>anyObject()))
            .andReturn(new RequestBuilder(httpClient, HttpMethod.DELETE, new URL("http://foo.com/delete")))
            .once();
    SettableFuture<Object> cancellationFuture = SettableFuture.create();
    EasyMock.expect(httpClient.go(EasyMock.<Request>anyObject())).andReturn(cancellationFuture).once();

    EasyMock.replay(httpClient);
View Full Code Here

TOP

Related Classes of com.metamx.http.client.RequestBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.