.httpMessageHeader(BraveHttpHeaders.SpanId.getName(), Long.toString(SPAN_ID, 16))
.httpMessageHeader(BraveHttpHeaders.Sampled.getName(), "true");
final HttpResponseImpl response = new HttpResponseImpl(200, null, null);
responseProvider.set(request, response);
final CloseableHttpClient httpclient =
HttpClients.custom().addInterceptorFirst(new BraveHttpRequestInterceptor(clientTracer, Optional.<String>absent()))
.addInterceptorFirst(new BraveHttpResponseInterceptor(clientTracer)).build();
try {
final HttpGet httpGet = new HttpGet(REQUEST_WITH_QUERY_PARAMS);
final CloseableHttpResponse httpClientResponse = httpclient.execute(httpGet);
try {
assertEquals(200, httpClientResponse.getStatusLine().getStatusCode());
} finally {
httpClientResponse.close();
}
mockServer.verify();
final InOrder inOrder = inOrder(clientTracer);
inOrder.verify(clientTracer).startNewSpan(PATH);
inOrder.verify(clientTracer).setCurrentClientServiceName(CONTEXT);
inOrder.verify(clientTracer).submitBinaryAnnotation("request", "GET " + FULL_PATH_WITH_QUERY_PARAMS);
inOrder.verify(clientTracer).setClientSent();
inOrder.verify(clientTracer).submitBinaryAnnotation("http.responsecode", 200);
inOrder.verify(clientTracer).setClientReceived();
verifyNoMoreInteractions(clientTracer);
} finally {
httpclient.close();
}
}