Changeset 12555 in josm for trunk/test/functional/org
- Timestamp:
- 2017-08-02T02:00:24+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java
r11250 r12555 59 59 }; 60 60 61 /** 62 * Setup test. 63 */ 61 64 @Before 62 65 public void setUp() { … … 240 243 } 241 244 242 245 /** 246 * Checks that a slow request is well handled if it completes before the timeout. 247 * @throws IOException if any I/O error occurs 248 */ 243 249 @Test 244 250 public void testRequestInTime() throws IOException { 245 final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/delay/3")).setReadTimeout(3500).connect(progress); 246 assertThat(response.getResponseCode(), is(200)); 247 } 248 251 final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/delay/1")).setReadTimeout(1500).connect(progress); 252 assertThat(response.getResponseCode(), is(200)); 253 } 254 255 /** 256 * Checks that a slow request results in the expected exception if it exceeds the timeout. 257 * @throws IOException always 258 */ 249 259 @Test(expected = IOException.class) 250 260 public void testTakesTooLong() throws IOException { 251 HttpClient.create(new URL("https://httpbin.org/delay/ 3")).setReadTimeout(2500).connect(progress);261 HttpClient.create(new URL("https://httpbin.org/delay/1")).setReadTimeout(500).connect(progress); 252 262 } 253 263
Note:
See TracChangeset
for help on using the changeset viewer.