@Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            try {
                if ("get".equals(method.getName())) {
                    ServiceLatencyProvider latencyProvider = new ServiceLatencyProvider(
                            AWSServiceMetrics.HttpClientGetConnectionTime);
                    try {
                        return method.invoke(orig, args);
                    } finally {
                        AwsSdkMetrics.getServiceMetricCollector()
                                .collectLatency(latencyProvider.endTiming());
                    }
                }
                return method.invoke(orig, args);
            } catch (InvocationTargetException e) {
                log.debug("", e);
                throw e.getCause();
            }
        }
The handler behind the dynamic proxy for {@link ConnectionRequest}
so that the latency of the
{@link ConnectionRequest#get(long, java.util.concurrent.TimeUnit)}
can be captured.
aws-java-sdk-core/src/main/java/com/amazonaws/http/conn/ClientConnectionRequestFactory.java