@Override
	public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {

		EnhancedPluginContext enhancedPluginContext = new EnhancedPluginContext();

		EnhancedRequestContext enhancedRequestContext = EnhancedRequestContext.builder()
				.httpHeaders(request.getHeaders())
				.httpMethod(request.getMethod())
				.url(request.getURI())
				.build();
		enhancedPluginContext.setRequest(enhancedRequestContext);
		enhancedPluginContext.setOriginRequest(request);

		enhancedPluginContext.setLocalServiceInstance(pluginRunner.getLocalServiceInstance());
		enhancedPluginContext.setTargetServiceInstance((ServiceInstance) MetadataContextHolder.get()
				.getLoadbalancerMetadata().get(LOAD_BALANCER_SERVICE_INSTANCE), request.getURI());

		// Run pre enhanced plugins.
		pluginRunner.run(EnhancedPluginType.Client.PRE, enhancedPluginContext);

		long startMillis = System.currentTimeMillis();
		try {
			ClientHttpResponse response = execution.execute(request, body);
			enhancedPluginContext.setDelay(System.currentTimeMillis() - startMillis);

			EnhancedResponseContext enhancedResponseContext = EnhancedResponseContext.builder()
					.httpStatus(response.getRawStatusCode())
					.httpHeaders(response.getHeaders())
					.build();
			enhancedPluginContext.setResponse(enhancedResponseContext);

			// Run post enhanced plugins.
			pluginRunner.run(EnhancedPluginType.Client.POST, enhancedPluginContext);
			return response;
		}
		catch (IOException e) {
			enhancedPluginContext.setDelay(System.currentTimeMillis() - startMillis);
			enhancedPluginContext.setThrowable(e);
			// Run exception enhanced plugins.
			pluginRunner.run(EnhancedPluginType.Client.EXCEPTION, enhancedPluginContext);
			throw e;
		}
		finally {
			// Run finally enhanced plugins.
			pluginRunner.run(EnhancedPluginType.Client.FINALLY, enhancedPluginContext);
		}
	}
@Test
	public void testRun() throws IOException, URISyntaxException {

		ClientHttpResponse actualResult;
		final byte[] inputBody = null;

		URI uri = new URI("http://0.0.0.0/");
		doReturn(uri).when(mockHttpRequest).getURI();
		doReturn(HttpMethod.GET).when(mockHttpRequest).getMethod();
		doReturn(mockHttpHeaders).when(mockHttpRequest).getHeaders();
		doReturn(mockClientHttpResponse).when(mockClientHttpRequestExecution).execute(mockHttpRequest, inputBody);

		EnhancedRestTemplateInterceptor reporter = new EnhancedRestTemplateInterceptor(new DefaultEnhancedPluginRunner(new ArrayList<>(), registration, null));
		actualResult = reporter.intercept(mockHttpRequest, inputBody, mockClientHttpRequestExecution);
		assertThat(actualResult).isEqualTo(mockClientHttpResponse);

		actualResult = reporter.intercept(mockHttpRequest, inputBody, mockClientHttpRequestExecution);
		assertThat(actualResult).isEqualTo(mockClientHttpResponse);

		doThrow(new SocketTimeoutException()).when(mockClientHttpRequestExecution).execute(mockHttpRequest, inputBody);
		assertThatThrownBy(() -> reporter.intercept(mockHttpRequest, inputBody, mockClientHttpRequestExecution)).isInstanceOf(SocketTimeoutException.class);
	}