private RestTemplate restTemplate(String serviceUrl) {
		ClientHttpRequestFactory requestFactory = this.eurekaClientHttpRequestFactorySupplier
			.get(this.sslContext.orElse(null), this.hostnameVerifier.orElse(null));

		RestTemplate restTemplate;

		if (restTemplateBuilderSupplier != null && restTemplateBuilderSupplier.get() != null) {
			// Avoid using RestTemplateBuilder.requestFactory(() -> requestFactory)
			// when we have a concrete type, the reflective builder can throw errors if
			// there is custom configuration (ie Redirects.DONT_FOLLOW) gh-4423
			restTemplate = restTemplateBuilderSupplier.get().build();
			restTemplate.setRequestFactory(requestFactory);
		}
		else {
			restTemplate = new RestTemplate(requestFactory);
		}

		final EurekaHttpClientUtils.UserInfo userInfo = extractUserInfo(serviceUrl);
		if (userInfo != null) {
			restTemplate.getInterceptors()
				.add(new BasicAuthenticationInterceptor(userInfo.username(), userInfo.password()));
		}

		restTemplate.getMessageConverters().add(0, mappingJacksonHttpMessageConverter());
		restTemplate.setErrorHandler(new ErrorHandler());

		restTemplate.getInterceptors().add((request, body, execution) -> {
			ClientHttpResponse response = execution.execute(request, body);
			if (!response.getStatusCode().equals(HttpStatus.NOT_FOUND)) {
				return response;
			}
			return new NotFoundHttpResponse(response);
		});

		return restTemplate;
	}
@deprecated pass the default values while initialising object in test classes.
spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactory.java