diff --git a/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java b/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java
new file mode 100644
index 0000000000..93949e52a3
--- /dev/null
+++ b/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java
@@ -0,0 +1,50 @@
+package com.baeldung.resttemplate.proxy;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.Proxy.Type;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * This class is used to test a request using {@link RestTemplate} with {@link Proxy}
+ * using a {@link SimpleClientHttpRequestFactory} as configuration.
+ *
+ *
+ *
+ * Before running the test we should change the PROXY_SERVER_HOST
+ * and PROXY_SERVER_PORT constants in our class to match our preferred proxy configuration.
+ */
+public class RequestFactoryLiveTest {
+
+ private static final String PROXY_SERVER_HOST = "127.0.0.1";
+ private static final int PROXY_SERVER_PORT = 8080;
+
+ RestTemplate restTemplate;
+
+ @Before
+ public void setUp() {
+ Proxy proxy = new Proxy(Type.HTTP, new InetSocketAddress(PROXY_SERVER_HOST, PROXY_SERVER_PORT));
+
+ SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+ requestFactory.setProxy(proxy);
+
+ restTemplate = new RestTemplate(requestFactory);
+ }
+
+ @Test
+ public void givenRestTemplate_whenRequestedWithProxy_thenResponseBodyIsOk() {
+ ResponseEntity responseEntity = restTemplate.getForEntity("http://httpbin.org/get", String.class);
+
+ assertThat(responseEntity.getStatusCode(), is(equalTo(HttpStatus.OK)));
+ }
+}
diff --git a/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java b/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java
new file mode 100644
index 0000000000..faeb49537a
--- /dev/null
+++ b/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java
@@ -0,0 +1,69 @@
+package com.baeldung.resttemplate.proxy;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.net.Proxy;
+
+import org.apache.http.HttpException;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.conn.DefaultProxyRoutePlanner;
+import org.apache.http.protocol.HttpContext;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.boot.web.client.RestTemplateCustomizer;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * This class is used to test a request using {@link RestTemplate} with {@link Proxy}
+ * using a {@link RestTemplateCustomizer} as configuration.
+ *
+ *
+ *
+ * Before running the test we should change the PROXY_SERVER_HOST
+ * and PROXY_SERVER_PORT constants in our class to match our preferred proxy configuration.
+ */
+public class RestTemplateCustomizerLiveTest {
+
+ private static final String PROXY_SERVER_HOST = "127.0.0.1";
+ private static final int PROXY_SERVER_PORT = 8080;
+
+ RestTemplate restTemplate;
+
+ @Before
+ public void setUp() {
+ restTemplate = new RestTemplateBuilder(new ProxyCustomizer()).build();
+ }
+
+ @Test
+ public void givenRestTemplate_whenRequestedWithProxy_thenResponseBodyIsOk() {
+ ResponseEntity responseEntity = restTemplate.getForEntity("http://httpbin.org/get", String.class);
+
+ assertThat(responseEntity.getStatusCode(), is(equalTo(HttpStatus.OK)));
+ }
+
+ private static class ProxyCustomizer implements RestTemplateCustomizer {
+
+ @Override
+ public void customize(RestTemplate restTemplate) {
+ HttpHost proxy = new HttpHost(PROXY_SERVER_HOST, PROXY_SERVER_PORT);
+ HttpClient httpClient = HttpClientBuilder.create()
+ .setRoutePlanner(new DefaultProxyRoutePlanner(proxy) {
+ @Override
+ public HttpHost determineProxy(HttpHost target, HttpRequest request, HttpContext context) throws HttpException {
+ return super.determineProxy(target, request, context);
+ }
+ })
+ .build();
+ restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory(httpClient));
+ }
+ }
+}