Examples of HttpFetcher


Examples of org.apache.shindig.gadgets.http.HttpFetcher

    out.write(content);
    out.close();
  }
 
  private HttpFetcher mockFetcher(Uri toFetch, String content) throws Exception {
    HttpFetcher fetcher = createMock(HttpFetcher.class);
    HttpRequest req = new HttpRequest(toFetch);
    HttpResponse resp =
        new HttpResponseBuilder().setHttpStatusCode(HttpResponse.SC_OK)
                                 .setResponseString(content).create();
    expect(fetcher.fetch(eq(req))).andReturn(resp);
    replay(fetcher);
    return fetcher;
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test
  public void testGetTamperedRawContent() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody("yo momma".getBytes());
        return serviceProvider.fetch(request);
      }
    });
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test(expected=RuntimeException.class)
  public void testGetTamperedFormContent() throws Exception {
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody("foo=quux".getBytes());
        return serviceProvider.fetch(request);
      }
    });
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test(expected=RuntimeException.class)
  public void testGetTamperedRemoveRawContent() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
        request.setHeader("Content-Type", "application/x-www-form-urlencoded");
        return serviceProvider.fetch(request);
      }
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test(expected=RuntimeException.class)
  public void testPostTamperedRawContent() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody("yo momma".getBytes());
        return serviceProvider.fetch(request);
      }
    });
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test(expected=RuntimeException.class)
  public void testPostTamperedFormContent() throws Exception {
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody("foo=quux".getBytes());
        return serviceProvider.fetch(request);
      }
    });
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test(expected=RuntimeException.class)
  public void testPostTamperedRemoveRawContent() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
        request.setHeader("Content-Type", "application/x-www-form-urlencoded");
        return serviceProvider.fetch(request);
      }
View Full Code Here

Examples of org.openid4java.util.HttpFetcher


    public void testIncompleteHtmlParsing() throws DiscoveryException
    {
        // stop reading from the received HTML body shortly after the Yadis tag
        HttpFetcher cache = new HttpCache();
        HttpRequestOptions requestOptions = cache.getRequestOptions();
        requestOptions.setMaxBodySize(350);
        cache.setDefaultRequestOptions(requestOptions);

        YadisResolver resolver = new YadisResolver(cache);
        YadisResult result = resolver.discover("http://localhost:" + _servletPort + "/?html=simplehtml",
            10, Collections.singleton("http://example.com/"));
View Full Code Here

Examples of org.openid4java.util.HttpFetcher

    public void testXrdsSizeExceeded()
    {
        HttpRequestOptions requestOptions = new HttpRequestOptions();
        requestOptions.setMaxBodySize(10);

        HttpFetcher cache = new HttpCache();
        cache.setDefaultRequestOptions(requestOptions);

        YadisResolver resolver = new YadisResolver(cache);

        try
        {
View Full Code Here

Examples of org.openid4java.util.HttpFetcher

public class InjectionTest extends TestCase {

  public void testNonGuice() throws Exception {
    ConsumerManager m = new ConsumerManager();
    HttpFetcher fetcher = m.getHttpFetcher();

    assertTrue(fetcher instanceof HttpCache);
    assertEquals(0, fetcher.getDefaultRequestOptions().getMaxRedirects());

    YadisResolver yadis = m.getDiscovery().getYadisResolver();
    fetcher = yadis.getHttpFetcher();

    assertTrue(fetcher instanceof HttpCache);
    assertEquals(10, fetcher.getDefaultRequestOptions().getMaxRedirects());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.