Package org.springframework.http.client

Examples of org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory


  private AsyncRestTemplate template;


  @Before
  public void createTemplate() {
    template = new AsyncRestTemplate(new HttpComponentsAsyncClientHttpRequestFactory());
  }
View Full Code Here


  public void restartWithKeepAlive() throws Exception {
    AbstractEmbeddedServletContainerFactory factory = getFactory();
    this.container = factory
        .getEmbeddedServletContainer(exampleServletRegistration());
    this.container.start();
    HttpComponentsAsyncClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsAsyncClientHttpRequestFactory();
    ListenableFuture<ClientHttpResponse> response1 = clientHttpRequestFactory
        .createAsyncRequest(new URI(getLocalUrl("/hello")), HttpMethod.GET)
        .executeAsync();
    assertThat(response1.get(10, TimeUnit.SECONDS).getRawStatusCode(), equalTo(200));

    this.container.stop();
    this.container = factory
        .getEmbeddedServletContainer(exampleServletRegistration());
    this.container.start();

    ListenableFuture<ClientHttpResponse> response2 = clientHttpRequestFactory
        .createAsyncRequest(new URI(getLocalUrl("/hello")), HttpMethod.GET)
        .executeAsync();
    assertThat(response2.get(10, TimeUnit.SECONDS).getRawStatusCode(), equalTo(200));
  }
View Full Code Here

TOP

Related Classes of org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory

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.