Examples of HttpGet


Examples of org.apache.http.client.methods.HttpGet

  @Test
  public void HTTP_1_0_noConnectionHeaderTest() throws ClientProtocolException, IOException {
    HttpParams params = new BasicHttpParams();
    HttpProtocolParams.setVersion(params, new ProtocolVersion("HTTP", 1, 0));
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/");
    HttpResponse response = httpclient.execute(httpget);

    assertNotNull(response);
    assertEquals(200, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
View Full Code Here

Examples of org.apache.http.client.methods.HttpGet


  @Test
  public void httpExceptionTest() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/throw");
    HttpResponse response = httpclient.execute(httpget);

    assertNotNull(response);
    assertEquals(500, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
View Full Code Here

Examples of org.apache.http.client.methods.HttpGet

  }

  @Test
  public void asyncHttpExceptionTest() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/async_throw");
    HttpResponse response = httpclient.execute(httpget);

    assertNotNull(response);
    assertEquals(500, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
View Full Code Here

Examples of org.apache.http.client.methods.HttpGet

  }

  @Test
  public void staticFileRequestTest() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/src/test/resources/test.txt");
    HttpResponse response = httpclient.execute(httpget);

    assertNotNull(response);
    assertEquals(200, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
View Full Code Here

Examples of org.apache.http.client.methods.HttpGet

  }

  @Test
  public void pictureStaticFileRequestTest() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/src/test/resources/n792205362_2067.jpg");
    HttpResponse response = httpclient.execute(httpget);

    assertNotNull(response);
    assertEquals(200, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
View Full Code Here

Examples of org.apache.http.client.methods.HttpGet

  }
 
  @Test
  public void pictureStaticLargeFileRequestTest() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/src/test/resources/f4_impact_1_original.jpg");
    HttpResponse response = httpclient.execute(httpget);

    assertNotNull(response);
    assertEquals(200, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
View Full Code Here

Examples of org.apache.http.client.methods.HttpGet

  }

  @Test
  public void noBodyRequest() throws ClientProtocolException, IOException {
    HttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/no_body");
    HttpResponse response = httpclient.execute(httpget);
    List<String> expectedHeaders = Arrays.asList(new String[] {"Server", "Date", "Content-Length", "Connection"});

    assertEquals(200, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
View Full Code Here

Examples of org.apache.http.client.methods.HttpGet

  }

  @Test
  public void movedPermanentlyRequest() throws ClientProtocolException, IOException {
    HttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/moved_perm");
    HttpResponse response = httpclient.execute(httpget);
    List<String> expectedHeaders = Arrays.asList(new String[] {"Server", "Date", "Content-Length", "Connection", "Etag"});

    assertEquals(200, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
View Full Code Here

Examples of org.apache.http.client.methods.HttpGet

  @Test
  public void userDefinedStaticContentHandlerTest() throws ClientProtocolException, IOException {
    // /static_file_handler
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/static_file_handler");
    HttpResponse response = httpclient.execute(httpget);

    assertNotNull(response);
    assertEquals(200, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
View Full Code Here

Examples of org.apache.http.client.methods.HttpGet

  }

  @Test
  public void keyValueStoreClientTest() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/keyvalue");
    HttpResponse response = httpclient.execute(httpget);

    assertNotNull(response);
    assertEquals(200, response.getStatusLine().getStatusCode());
    assertEquals(new ProtocolVersion("HTTP", 1, 1), response.getStatusLine().getProtocolVersion());
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.