Java 类org.apache.http.client.methods.HttpTrace 实例源码

项目:elasticsearch_my    文件:RestClient.java   
private static HttpRequestBase createHttpRequest(String method, URI uri, HttpEntity entity) {
    switch(method.toUpperCase(Locale.ROOT)) {
        case HttpDeleteWithEntity.METHOD_NAME:
            return addRequestBody(new HttpDeleteWithEntity(uri), entity);
        case HttpGetWithEntity.METHOD_NAME:
            return addRequestBody(new HttpGetWithEntity(uri), entity);
        case HttpHead.METHOD_NAME:
            return addRequestBody(new HttpHead(uri), entity);
        case HttpOptions.METHOD_NAME:
            return addRequestBody(new HttpOptions(uri), entity);
        case HttpPatch.METHOD_NAME:
            return addRequestBody(new HttpPatch(uri), entity);
        case HttpPost.METHOD_NAME:
            HttpPost httpPost = new HttpPost(uri);
            addRequestBody(httpPost, entity);
            return httpPost;
        case HttpPut.METHOD_NAME:
            return addRequestBody(new HttpPut(uri), entity);
        case HttpTrace.METHOD_NAME:
            return addRequestBody(new HttpTrace(uri), entity);
        default:
            throw new UnsupportedOperationException("http method not supported: " + method);
    }
}
项目:elasticsearch_my    文件:RequestLoggerTests.java   
private static HttpUriRequest randomHttpRequest(URI uri) {
    int requestType = randomIntBetween(0, 7);
    switch(requestType) {
        case 0:
            return new HttpGetWithEntity(uri);
        case 1:
            return new HttpPost(uri);
        case 2:
            return new HttpPut(uri);
        case 3:
            return new HttpDeleteWithEntity(uri);
        case 4:
            return new HttpHead(uri);
        case 5:
            return new HttpTrace(uri);
        case 6:
            return new HttpOptions(uri);
        case 7:
            return new HttpPatch(uri);
        default:
            throw new UnsupportedOperationException();
    }
}
项目:lams    文件:HttpComponentsClientHttpRequestFactory.java   
/**
 * Create a Commons HttpMethodBase object for the given HTTP method and URI specification.
 * @param httpMethod the HTTP method
 * @param uri the URI
 * @return the Commons HttpMethodBase object
 */
protected HttpUriRequest createHttpUriRequest(HttpMethod httpMethod, URI uri) {
    switch (httpMethod) {
        case GET:
            return new HttpGet(uri);
        case DELETE:
            return new HttpDelete(uri);
        case HEAD:
            return new HttpHead(uri);
        case OPTIONS:
            return new HttpOptions(uri);
        case POST:
            return new HttpPost(uri);
        case PUT:
            return new HttpPut(uri);
        case TRACE:
            return new HttpTrace(uri);
        case PATCH:
            return new HttpPatch(uri);
        default:
            throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
    }
}
项目:spring4-understanding    文件:HttpComponentsClientHttpRequestFactory.java   
/**
 * Create a Commons HttpMethodBase object for the given HTTP method and URI specification.
 * @param httpMethod the HTTP method
 * @param uri the URI
 * @return the Commons HttpMethodBase object
 */
protected HttpUriRequest createHttpUriRequest(HttpMethod httpMethod, URI uri) {
    switch (httpMethod) {
        case GET:
            return new HttpGet(uri);
        case HEAD:
            return new HttpHead(uri);
        case POST:
            return new HttpPost(uri);
        case PUT:
            return new HttpPut(uri);
        case PATCH:
            return new HttpPatch(uri);
        case DELETE:
            return new HttpDelete(uri);
        case OPTIONS:
            return new HttpOptions(uri);
        case TRACE:
            return new HttpTrace(uri);
        default:
            throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
    }
}
项目:AuxiliumLib    文件:MattpRequestEnvoy.java   
private HttpUriRequest getRawMethodRequest()
{
    AbstractURL url = request.getUrl();

    switch(request.getMattpMethod())
    {
        case GET:
            return new HttpGet(url.toString());
        case HEAD:
            return new HttpHead(url.toString());
        case POST:
            return new HttpPost(url.toString());
        case PUT:
            return new HttpPut(url.toString());
        case DELETE:
            return new HttpDelete(url.toString());
        case TRACE:
            return new HttpTrace(url.toString());
        case OPTIONS:
            return new HttpOptions(url.toString());
        case PATCH:
            return new HttpPatch(url.toString());
    }

    throw new ShouldNeverHappenError();
}
项目:AuxiliumLib    文件:HttpFetch.java   
private HttpUriRequest getRequest(AbstractURL url)
{
    switch(this)
    {
        case GET:
            return new HttpGet(url.toString());
        case HEAD:
            return new HttpHead(url.toString());
        case POST:
            return new HttpPost(url.toString());
        case PUT:
            return new HttpPut(url.toString());
        case DELETE:
            return new HttpDelete(url.toString());
        case TRACE:
            return new HttpTrace(url.toString());
        case OPTIONS:
            return new HttpOptions(url.toString());
        case PATCH:
            return new HttpPatch(url.toString());
    }

    throw new ShouldNeverHappenError();
}
项目:vespa    文件:JDiscHttpServletTest.java   
@Test
public void requireThatServerRespondsToAllMethods() throws Exception {
    final TestDriver driver = TestDrivers.newInstance(newEchoHandler());
    final URI uri = driver.client().newUri("/status.html");
    driver.client().execute(new HttpGet(uri))
          .expectStatusCode(is(OK));
    driver.client().execute(new HttpPost(uri))
          .expectStatusCode(is(OK));
    driver.client().execute(new HttpHead(uri))
          .expectStatusCode(is(OK));
    driver.client().execute(new HttpPut(uri))
          .expectStatusCode(is(OK));
    driver.client().execute(new HttpDelete(uri))
          .expectStatusCode(is(OK));
    driver.client().execute(new HttpOptions(uri))
          .expectStatusCode(is(OK));
    driver.client().execute(new HttpTrace(uri))
          .expectStatusCode(is(OK));
    driver.client().execute(new HttpPatch(uri))
            .expectStatusCode(is(OK));
    assertThat(driver.close(), is(true));
}
项目:fahrschein    文件:HttpComponentsRequestFactory.java   
/**
 * Create a Commons HttpMethodBase object for the given HTTP method and URI specification.
 * @param method the HTTP method
 * @param uri the URI
 * @return the Commons HttpMethodBase object
 */
private static HttpUriRequest createHttpUriRequest(String method, URI uri) {
    switch (method) {
        case "GET":
            return new HttpGet(uri);
        case "HEAD":
            return new HttpHead(uri);
        case "POST":
            return new HttpPost(uri);
        case "PUT":
            return new HttpPut(uri);
        case "PATCH":
            return new HttpPatch(uri);
        case "DELETE":
            return new HttpDelete(uri);
        case "OPTIONS":
            return new HttpOptions(uri);
        case "TRACE":
            return new HttpTrace(uri);
        default:
            throw new IllegalArgumentException("Invalid HTTP method: " + method);
    }
}
项目:purecloud-iot    文件:TestDefaultRedirectStrategy.java   
@Test
public void testGetRedirectRequestForTemporaryRedirect() throws Exception {
    final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
    final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
            HttpStatus.SC_TEMPORARY_REDIRECT, "Temporary Redirect");
    response.addHeader("Location", "http://localhost/stuff");
    final HttpContext context1 = new BasicHttpContext();
    final HttpUriRequest redirect1 = redirectStrategy.getRedirect(
            new HttpTrace("http://localhost/"), response, context1);
    Assert.assertEquals("TRACE", redirect1.getMethod());
    final HttpContext context2 = new BasicHttpContext();
    final HttpPost httppost = new HttpPost("http://localhost/");
    final HttpEntity entity = new BasicHttpEntity();
    httppost.setEntity(entity);
    final HttpUriRequest redirect2 = redirectStrategy.getRedirect(
            httppost, response, context2);
    Assert.assertEquals("POST", redirect2.getMethod());
    Assert.assertTrue(redirect2 instanceof HttpEntityEnclosingRequest);
    Assert.assertSame(entity, ((HttpEntityEnclosingRequest) redirect2).getEntity());
}
项目:here-aaa-java-sdk    文件:ApacheHttpClientProviderTest.java   
@Test
public void test_methods() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException, ClassNotFoundException {
    verifyApacheType("GET", HttpGet.class);
    verifyApacheType("POST", HttpPost.class);
    verifyApacheType("PUT", HttpPut.class);
    verifyApacheType("DELETE", HttpDelete.class);
    verifyApacheType("HEAD", HttpHead.class);
    verifyApacheType("OPTIONS", HttpOptions.class);
    verifyApacheType("TRACE", HttpTrace.class);
    verifyApacheType("PATCH", HttpPatch.class);
    try {
        verifyApacheType("BROKENMETHOD", null);
        fail("BROKENMETHOD should have thrown IllegalArgumentException, but didn't");
    } catch (IllegalArgumentException e) {
        // expected
        String message = e.getMessage();
        String expectedContains = "no support for request method=BROKENMETHOD";
        assertTrue("expected contains "+expectedContains+", actual "+message, message.contains(expectedContains));
    }
}
项目:ShoppingMall    文件:HttpComponentsClientHttpRequestFactory.java   
/**
 * Create a HttpComponents HttpUriRequest object for the given HTTP method and URI specification.
 * 
 * @param httpMethod the HTTP method
 * @param uri the URI
 * @return the HttpComponents HttpUriRequest object
 */
protected HttpUriRequest createHttpRequest(HttpMethod httpMethod, URI uri) {
    switch (httpMethod) {
        case GET:
            return new HttpGet(uri);
        case DELETE:
            return new HttpDelete(uri);
        case HEAD:
            return new HttpHead(uri);
        case OPTIONS:
            return new HttpOptions(uri);
        case POST:
            return new HttpPost(uri);
        case PUT:
            return new HttpPut(uri);
        case TRACE:
            return new HttpTrace(uri);
        default:
            throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
    }
}
项目:ShoppingMall    文件:HttpComponentsClientHttpRequestFactory.java   
/**
 * Create a HttpComponents HttpUriRequest object for the given HTTP method and URI specification.
 * 
 * @param httpMethod
 *            the HTTP method
 * @param uri
 *            the URI
 * @return the HttpComponents HttpUriRequest object
 */
protected HttpUriRequest createHttpRequest(HttpMethod httpMethod, URI uri) {
    switch (httpMethod) {
    case GET:
        return new HttpGet(uri);
    case DELETE:
        return new HttpDelete(uri);
    case HEAD:
        return new HttpHead(uri);
    case OPTIONS:
        return new HttpOptions(uri);
    case POST:
        return new HttpPost(uri);
    case PUT:
        return new HttpPut(uri);
    case TRACE:
        return new HttpTrace(uri);
    default:
        throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
    }
}
项目:openbd-core    文件:cfHttpConnection.java   
private HttpUriRequest resolveMethod( String _method, boolean _multipart ) throws cfmRunTimeException {
    String method = _method.toUpperCase();
    if ( method.equals( "GET" ) ) {
        return new HttpGet();
    } else if ( method.equals( "POST" ) ) {
        return new HttpPost();
    } else if ( method.equals( "HEAD" ) ) {
        return new HttpHead();
    } else if ( method.equals( "TRACE" ) ) {
        return new HttpTrace();
    } else if ( method.equals( "DELETE" ) ) {
        return new HttpDelete();
    } else if ( method.equals( "OPTIONS" ) ) {
        return new HttpOptions();
    } else if ( method.equals( "PUT" ) ) {
        return new HttpPut();
    }
    throw newRunTimeException( "Unsupported METHOD value [" + method + "]. Valid METHOD values are GET, POST, HEAD, TRACE, DELETE, OPTIONS and PUT." );
}
项目:detective    文件:HttpClientTask.java   
/**
 * Create a Commons HttpMethodBase object for the given HTTP method and URI specification.
 * @param httpMethod the HTTP method
 * @param uri the URI
 * @return the Commons HttpMethodBase object
 */
protected HttpUriRequest createHttpUriRequest(HttpMethod httpMethod, URI uri) {
  switch (httpMethod) {
    case GET:
      return new HttpGet(uri);
    case DELETE:
      return new HttpDeleteWithBody(uri);
    case HEAD:
      return new HttpHead(uri);
    case OPTIONS:
      return new HttpOptions(uri);
    case POST:
      return new HttpPost(uri);
    case PUT:
      return new HttpPut(uri);
    case TRACE:
      return new HttpTrace(uri);
    case PATCH:
      return new HttpPatch(uri);
    default:
      throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
  }
}
项目:class-guard    文件:HttpComponentsClientHttpRequestFactory.java   
/**
 * Create a Commons HttpMethodBase object for the given HTTP method and URI specification.
 * @param httpMethod the HTTP method
 * @param uri the URI
 * @return the Commons HttpMethodBase object
 */
protected HttpUriRequest createHttpUriRequest(HttpMethod httpMethod, URI uri) {
    switch (httpMethod) {
        case GET:
            return new HttpGet(uri);
        case DELETE:
            return new HttpDelete(uri);
        case HEAD:
            return new HttpHead(uri);
        case OPTIONS:
            return new HttpOptions(uri);
        case POST:
            return new HttpPost(uri);
        case PUT:
            return new HttpPut(uri);
        case TRACE:
            return new HttpTrace(uri);
        case PATCH:
            return new HttpPatch(uri);
        default:
            throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
    }
}
项目:camunda-connect    文件:HttpRequestTest.java   
@Test
public void setHttpMethod() {
  HttpRequest request = connector.createRequest().get();
  assertThat(request.getMethod()).isEqualTo(HttpGet.METHOD_NAME);

  request = connector.createRequest().post();
  assertThat(request.getMethod()).isEqualTo(HttpPost.METHOD_NAME);

  request = connector.createRequest().put();
  assertThat(request.getMethod()).isEqualTo(HttpPut.METHOD_NAME);

  request = connector.createRequest().delete();
  assertThat(request.getMethod()).isEqualTo(HttpDelete.METHOD_NAME);

  request = connector.createRequest().patch();
  assertThat(request.getMethod()).isEqualTo(HttpPatch.METHOD_NAME);

  request = connector.createRequest().head();
  assertThat(request.getMethod()).isEqualTo(HttpHead.METHOD_NAME);

  request = connector.createRequest().options();
  assertThat(request.getMethod()).isEqualTo(HttpOptions.METHOD_NAME);

  request = connector.createRequest().trace();
  assertThat(request.getMethod()).isEqualTo(HttpTrace.METHOD_NAME);
}
项目:ZombieLink    文件:RequestUtils.java   
/**
 * <p>Retrieves the proper extension of {@link HttpRequestBase} for the given {@link InvocationContext}. 
 * This implementation is solely dependent upon the {@link RequestMethod} property in the annotated 
 * metdata of the endpoint method definition.</p>
 *
 * @param context
 *          the {@link InvocationContext} for which a {@link HttpRequestBase} is to be generated 
 * <br><br>
 * @return the {@link HttpRequestBase} translated from the {@link InvocationContext}'s {@link RequestMethod}
 * <br><br>
 * @throws NullPointerException
 *          if the supplied {@link InvocationContext} was {@code null} 
 * <br><br>
 * @since 1.3.0
 */
static HttpRequestBase translateRequestMethod(InvocationContext context) {

    RequestMethod requestMethod = Metadata.findMethod(assertNotNull(context).getRequest());

    switch (requestMethod) {

        case POST: return new HttpPost();
        case PUT: return new HttpPut();
        case PATCH: return new HttpPatch();
        case DELETE: return new HttpDelete();
        case HEAD: return new HttpHead();
        case TRACE: return new HttpTrace();
        case OPTIONS: return new HttpOptions();

        case GET: default: return new HttpGet();
    }
}
项目:RoboZombie    文件:RequestUtils.java   
/**
 * <p>Retrieves the proper extension of {@link HttpRequestBase} for the given {@link InvocationContext}. 
 * This implementation is solely dependent upon the {@link RequestMethod} property in the annotated 
 * metdata of the endpoint method definition.</p>
 *
 * @param context
 *          the {@link InvocationContext} for which a {@link HttpRequestBase} is to be generated 
 * <br><br>
 * @return the {@link HttpRequestBase} translated from the {@link InvocationContext}'s {@link RequestMethod}
 * <br><br>
 * @throws NullPointerException
 *          if the supplied {@link InvocationContext} was {@code null} 
 * <br><br>
 * @since 1.3.0
 */
static HttpRequestBase translateRequestMethod(InvocationContext context) {

    RequestMethod requestMethod = Metadata.findMethod(assertNotNull(context).getRequest());

    switch (requestMethod) {

        case POST: return new HttpPost();
        case PUT: return new HttpPut();
        case PATCH: return new HttpPatch();
        case DELETE: return new HttpDelete();
        case HEAD: return new HttpHead();
        case TRACE: return new HttpTrace();
        case OPTIONS: return new HttpOptions();

        case GET: default: return new HttpGet();
    }
}
项目:GitHub    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:GitHub    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:Codeforces    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:iosched-reader    文件:HttpClientStackTest.java   
public void testCreateTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:VoV    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:smconf-android    文件:HttpClientStackTest.java   
public void testCreateTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:volley    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:InfoQ-Android-App    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:volley-public-key-pinning    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:device-database    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:ShoppingApp    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:2015-Google-I-O-app    文件:HttpClientStackTest.java   
public void testCreateTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:Simplified-Zhihu-Daily    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:TastySnake    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:SaveVolley    文件:HttpClientStackTest.java   
@Test public void createTraceRequest() throws Exception {
    TestRequest.Trace request = new TestRequest.Trace();
    assertEquals(request.getMethod(), Method.TRACE);

    HttpUriRequest httpRequest = HttpClientStack.createHttpRequest(request, null);
    assertTrue(httpRequest instanceof HttpTrace);
}
项目:FakeLocation    文件:SSLServerSocketFactoryTest.java   
@Test
public void testSSLConnection() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpTrace httphead = new HttpTrace("https://localhost:9043/index.html");
    HttpResponse response = httpclient.execute(httphead);
    HttpEntity entity = response.getEntity();
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());

    Assert.assertEquals(9043, this.testServer.getListeningPort());
    Assert.assertTrue(this.testServer.isAlive());
}
项目:FakeLocation    文件:HttpSSLServerTest.java   
@Test
public void testSSLConnection() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpTrace httphead = new HttpTrace("https://localhost:9043/index.html");
    HttpResponse response = httpclient.execute(httphead);
    HttpEntity entity = response.getEntity();
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());

    Assert.assertEquals(9043, this.testServer.getListeningPort());
    Assert.assertTrue(this.testServer.isAlive());
}
项目:FakeLocation    文件:HttpSSLServerTest.java   
/**
 * using http to connect to https.
 * 
 * @throws ClientProtocolException
 * @throws IOException
 */
@Test(expected = ClientProtocolException.class)
public void testHttpOnSSLConnection() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpTrace httphead = new HttpTrace("http://localhost:9043/index.html");
    httpclient.execute(httphead);
}
项目:FakeLocation    文件:SSLServerSocketFactoryTest.java   
@Test
public void testSSLConnection() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpTrace httphead = new HttpTrace("https://localhost:9043/index.html");
    HttpResponse response = httpclient.execute(httphead);
    HttpEntity entity = response.getEntity();
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());

    Assert.assertEquals(9043, this.testServer.getListeningPort());
    Assert.assertTrue(this.testServer.isAlive());
}
项目:FakeLocation    文件:HttpSSLServerTest.java   
@Test
public void testSSLConnection() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpTrace httphead = new HttpTrace("https://localhost:9043/index.html");
    HttpResponse response = httpclient.execute(httphead);
    HttpEntity entity = response.getEntity();
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());

    Assert.assertEquals(9043, this.testServer.getListeningPort());
    Assert.assertTrue(this.testServer.isAlive());
}
项目:FakeLocation    文件:HttpSSLServerTest.java   
/**
 * using http to connect to https.
 * 
 * @throws ClientProtocolException
 * @throws IOException
 */
@Test(expected = ClientProtocolException.class)
public void testHttpOnSSLConnection() throws ClientProtocolException, IOException {
    DefaultHttpClient httpclient = new DefaultHttpClient();
    HttpTrace httphead = new HttpTrace("http://localhost:9043/index.html");
    httpclient.execute(httphead);
}
项目:purecloud-iot    文件:TestBasicHttpCache.java   
@Test
public void testDoNotFlushCacheEntriesOnTrace() throws Exception {
    final HttpHost host = new HttpHost("foo.example.com");
    final HttpRequest req = new HttpTrace("/bar");
    final String key = (new CacheKeyGenerator()).getURI(host, req);
    final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry();

    backing.map.put(key, entry);

    impl.flushCacheEntriesFor(host, req);

    assertEquals(entry, backing.map.get(key));
}