Search in sources :

Example 81 with HttpHost

use of org.graylog.shaded.elasticsearch7.org.apache.http.HttpHost in project jaeger-client-java by jaegertracing.

the class JaegerRequestAndResponseInterceptorIntegrationTest method testAsyncHttpClientTracing.

@Test
public void testAsyncHttpClientTracing() throws Exception {
    HttpAsyncClientBuilder clientBuilder = HttpAsyncClients.custom();
    CloseableHttpAsyncClient client = TracingInterceptors.addTo(clientBuilder, tracer).build();
    client.start();
    // Verify that parent span is on top of the stack _before_ request is made
    assertEquals(parentSpan, tracer.activeSpan());
    // Make a request to the async client and wait for response
    client.execute(new HttpHost("localhost", mockServerRule.getPort()), new BasicHttpRequest("GET", "/testing"), new FutureCallback<org.apache.http.HttpResponse>() {

        @Override
        public void completed(org.apache.http.HttpResponse result) {
        }

        @Override
        public void failed(Exception ex) {
        }

        @Override
        public void cancelled() {
        }
    }).get();
    // Verify that parent span is on top of the stack _after_ request is made
    assertEquals(parentSpan, tracer.activeSpan());
    verifyTracing(parentSpan);
}
Also used : HttpHost(org.apache.http.HttpHost) CloseableHttpAsyncClient(org.apache.http.impl.nio.client.CloseableHttpAsyncClient) HttpResponse(org.mockserver.model.HttpResponse) BasicHttpRequest(org.apache.http.message.BasicHttpRequest) FutureCallback(org.apache.http.concurrent.FutureCallback) HttpAsyncClientBuilder(org.apache.http.impl.nio.client.HttpAsyncClientBuilder) Test(org.junit.Test)

Example 82 with HttpHost

use of org.graylog.shaded.elasticsearch7.org.apache.http.HttpHost in project jaeger-client-java by jaegertracing.

the class JaegerRequestAndResponseInterceptorIntegrationTest method testHttpClientTracing.

@Test
public void testHttpClientTracing() throws Exception {
    HttpClientBuilder clientBuilder = HttpClients.custom();
    CloseableHttpClient client = TracingInterceptors.addTo(clientBuilder, tracer).build();
    // Make a request to the sync client and wait for response
    client.execute(new HttpHost("localhost", mockServerRule.getPort()), new BasicHttpRequest("GET", "/testing"));
    verifyTracing(parentSpan);
}
Also used : CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) HttpHost(org.apache.http.HttpHost) HttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder) BasicHttpRequest(org.apache.http.message.BasicHttpRequest) Test(org.junit.Test)

Example 83 with HttpHost

use of org.graylog.shaded.elasticsearch7.org.apache.http.HttpHost in project brave by openzipkin.

the class TracingHttpAsyncClientBuilder_HttpAdapterTest method parseServerAddress_prefersAddress.

@Test
public void parseServerAddress_prefersAddress() throws UnknownHostException {
    when(request.getTarget()).thenReturn(new HttpHost(InetAddress.getByName("127.0.0.1")));
    assertParsedEndpoint().isEqualTo(Endpoint.newBuilder().ip("127.0.0.1").build());
}
Also used : HttpHost(org.apache.http.HttpHost) Test(org.junit.Test)

Example 84 with HttpHost

use of org.graylog.shaded.elasticsearch7.org.apache.http.HttpHost in project brave by openzipkin.

the class TracingHttpAsyncClientBuilder_HttpAdapterTest method parseServerAddress_ipAndPortFromHost.

@Test
public void parseServerAddress_ipAndPortFromHost() {
    when(request.getTarget()).thenReturn(new HttpHost("127.0.0.1", 9999));
    assertParsedEndpoint().isEqualTo(Endpoint.newBuilder().ip("127.0.0.1").port(9999).build());
}
Also used : HttpHost(org.apache.http.HttpHost) Test(org.junit.Test)

Example 85 with HttpHost

use of org.graylog.shaded.elasticsearch7.org.apache.http.HttpHost in project brave by openzipkin.

the class HttpAdapterTest method parseServerAddress_acceptsHostname.

@Test
public void parseServerAddress_acceptsHostname() {
    when(request.getTarget()).thenReturn(new HttpHost("127.0.0.1"));
    assertParsedEndpoint().isEqualTo(Endpoint.newBuilder().ip("127.0.0.1").build());
}
Also used : HttpHost(org.apache.http.HttpHost) Test(org.junit.Test)

Aggregations

HttpHost (org.apache.http.HttpHost)598 IOException (java.io.IOException)111 CredentialsProvider (org.apache.http.client.CredentialsProvider)105 UsernamePasswordCredentials (org.apache.http.auth.UsernamePasswordCredentials)102 HttpResponse (org.apache.http.HttpResponse)101 AuthScope (org.apache.http.auth.AuthScope)101 BasicCredentialsProvider (org.apache.http.impl.client.BasicCredentialsProvider)99 Test (org.junit.Test)86 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)84 URI (java.net.URI)68 HttpGet (org.apache.http.client.methods.HttpGet)66 HttpRequest (org.apache.http.HttpRequest)60 Header (org.apache.http.Header)56 HttpClientBuilder (org.apache.http.impl.client.HttpClientBuilder)56 HttpClientContext (org.apache.http.client.protocol.HttpClientContext)48 HttpEntity (org.apache.http.HttpEntity)47 RequestConfig (org.apache.http.client.config.RequestConfig)45 BasicScheme (org.apache.http.impl.auth.BasicScheme)45 URISyntaxException (java.net.URISyntaxException)44 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)43