### Question:
HttpClientHandler extends XRayHandler { @Override public void handleRequest(Event event) { HttpServiceDownstreamRequestEvent requestEvent = (HttpServiceDownstreamRequestEvent) event; URI uri = getUriFromEvent(requestEvent); if (isWithinAWSCall() || isXRaySamplingCall(uri) || isXRayPluginCall(uri)) { return; } String hostName = uri.getHost(); if (hostName == null) { hostName = requestEvent.getService(); } Subsegment subsegment = beginSubsegment(hostName); if (subsegment != null) { addRequestInformation(subsegment, requestEvent, uri); } }  @Override void handleRequest(Event event); @Override void handleResponse(Event event);  }### Answer:
@Test public void testHandleGetRequest() throws Exception { HttpServiceDownstreamRequestEvent requestEventSpy = spy(httpClientRequestEvent); httpClientHandler.handleRequest(requestEventSpy); Subsegment httpClientSubsegment = AWSXRay.getCurrentSubsegment(); Assert.assertEquals(Namespace.REMOTE.toString(), httpClientSubsegment.getNamespace()); Assert.assertEquals(new URI(SERVICE).getHost(), httpClientSubsegment.getName()); Assert.assertTrue(httpClientSubsegment.isInProgress()); Map<String, String> requestMap = (Map<String, String>) httpClientSubsegment.getHttp().get("request"); Assert.assertEquals(OPERATION, requestMap.get("method")); TraceID traceID = httpClientSubsegment.getParentSegment().getTraceId(); String parentID = httpClientSubsegment.getId(); TraceHeader.SampleDecision sampleDecision = parentSegment.isSampled() ? TraceHeader.SampleDecision.SAMPLED : TraceHeader.SampleDecision.NOT_SAMPLED; TraceHeader theTraceHeader = new TraceHeader(traceID, parentID, sampleDecision); verify(requestEventSpy).replaceHeader(TraceHeader.HEADER_KEY, theTraceHeader.toString()); Assert.assertEquals(parentSegment, httpClientSubsegment.getParentSegment()); Assert.assertEquals(1, parentSegment.getSubsegments().size()); }