Skip to content

Commit 1cdfa2e

Browse files
committed
[BAEL-13598] - Updated HttpClient Timeout article. moved code
1 parent e8e485b commit 1cdfa2e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

httpclient-simple/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
88
### Relevant Articles:
99

1010
- [HttpClient 4 – Get the Status Code](http://www.baeldung.com/httpclient-status-code)
11-
- [HttpClient with SSL](http://www.baeldung.com/httpclient-ssl)
11+
- [HttpClient with SSL](http://www.baeldung.com/httpclient-ssl)
12+
- [HttpClient Timeout](http://www.baeldung.com/httpclient-timeout)

httpclient/src/test/java/org/baeldung/httpclient/HttpClientTimeoutLiveTest.java renamed to httpclient-simple/src/test/java/org/baeldung/httpclient/HttpClientTimeoutLiveTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
package org.baeldung.httpclient;
22

3+
import static org.hamcrest.Matchers.equalTo;
4+
import static org.junit.Assert.assertThat;
5+
6+
import java.io.IOException;
7+
38
import org.apache.http.client.config.RequestConfig;
49
import org.apache.http.client.methods.CloseableHttpResponse;
510
import org.apache.http.client.methods.HttpGet;
611
import org.apache.http.config.SocketConfig;
7-
import org.apache.http.conn.HttpHostConnectException;
12+
import org.apache.http.conn.ConnectTimeoutException;
813
import org.apache.http.impl.client.CloseableHttpClient;
914
import org.apache.http.impl.client.HttpClientBuilder;
1015
import org.junit.After;
1116
import org.junit.Test;
1217

13-
import java.io.IOException;
14-
15-
import static org.hamcrest.Matchers.equalTo;
16-
import static org.junit.Assert.assertThat;
17-
1818
public class HttpClientTimeoutLiveTest {
1919

2020
private CloseableHttpResponse response;
@@ -71,7 +71,7 @@ public final void givenUsingNewApi_whenSettingTimeoutViaHighLevelApi_thenCorrect
7171
/**
7272
* This simulates a timeout against a domain with multiple routes/IPs to it (not a single raw IP)
7373
*/
74-
@Test(expected = HttpHostConnectException.class)
74+
@Test(expected = ConnectTimeoutException.class)
7575
public final void givenTimeoutIsConfigured_whenTimingOut_thenTimeoutException() throws IOException {
7676
final int timeout = 3;
7777

spring-security-rest-basic-auth/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com
77

88
### Relevant Articles:
99
- [Basic Authentication with the RestTemplate](http://www.baeldung.com/how-to-use-resttemplate-with-basic-authentication-in-spring)
10-
- [HttpClient Timeout](http://www.baeldung.com/httpclient-timeout)
1110
- [A Custom Filter in the Spring Security Filter Chain](http://www.baeldung.com/spring-security-custom-filter)
1211
- [Spring Security Basic Authentication](http://www.baeldung.com/spring-security-basic-authentication)

0 commit comments

Comments
 (0)