BAEL-3844 - Suggested adjustements

This commit is contained in:
Roque Santos 2020-06-03 19:51:49 -03:00
parent 020aff1160
commit 0d2076f299
2 changed files with 10 additions and 4 deletions

View File

@ -15,13 +15,16 @@ import org.springframework.http.ResponseEntity;
import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
public class RequestFactoryLiveTest { public class RequestFactoryUnitTest {
private static final String PROXY_SERVER_HOST = "127.0.0.1";
private static final int PROXY_SERVER_PORT = 8080;
RestTemplate restTemplate; RestTemplate restTemplate;
@Before @Before
public void setUp() { public void setUp() {
Proxy proxy = new Proxy(Type.HTTP, new InetSocketAddress("201.91.82.155", 3128)); Proxy proxy = new Proxy(Type.HTTP, new InetSocketAddress(PROXY_SERVER_HOST, PROXY_SERVER_PORT));
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setProxy(proxy); requestFactory.setProxy(proxy);

View File

@ -20,7 +20,10 @@ import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
public class RestTemplateCustomizerLiveTest { public class RestTemplateCustomizerUnitTest {
private static final String PROXY_SERVER_HOST = "127.0.0.1";
private static final int PROXY_SERVER_PORT = 8080;
RestTemplate restTemplate; RestTemplate restTemplate;
@ -40,7 +43,7 @@ public class RestTemplateCustomizerLiveTest {
@Override @Override
public void customize(RestTemplate restTemplate) { public void customize(RestTemplate restTemplate) {
HttpHost proxy = new HttpHost("201.91.82.155", 3128); HttpHost proxy = new HttpHost(PROXY_SERVER_HOST, PROXY_SERVER_PORT);
HttpClient httpClient = HttpClientBuilder.create() HttpClient httpClient = HttpClientBuilder.create()
.setRoutePlanner(new DefaultProxyRoutePlanner(proxy) { .setRoutePlanner(new DefaultProxyRoutePlanner(proxy) {
@Override @Override