Skip to content

Commit a69dc92

Browse files
committed
chore: remove redundant test
1 parent c4c3007 commit a69dc92

File tree

1 file changed

+1
-64
lines changed

1 file changed

+1
-64
lines changed

google-http-client-apache-v5/src/test/java/com/google/api/client/http/apache/v5/Apache5HttpTransportTest.java

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -216,69 +216,6 @@ public void testConnectTimeout() {
216216
}
217217
}
218218

219-
@Test(timeout = 5000)
220-
public void testConnectionRequestTimeout() throws Exception {
221-
final CountDownLatch latch = new CountDownLatch(1);
222-
final HttpRequestHandler handler =
223-
new HttpRequestHandler() {
224-
@Override
225-
public void handle(
226-
ClassicHttpRequest request, ClassicHttpResponse response, HttpContext context)
227-
throws HttpException, IOException {
228-
try {
229-
latch.await(); // Wait for the signal to proceed
230-
} catch (InterruptedException e) {
231-
Thread.currentThread().interrupt();
232-
}
233-
response.setCode(HttpStatus.SC_OK);
234-
}
235-
};
236-
237-
try (FakeServer server = new FakeServer(handler)) {
238-
PoolingHttpClientConnectionManager connectionManager =
239-
new PoolingHttpClientConnectionManager();
240-
connectionManager.setMaxTotal(1);
241-
242-
RequestConfig requestConfig =
243-
RequestConfig.custom().setConnectionRequestTimeout(1, TimeUnit.SECONDS).build();
244-
245-
HttpClient httpClient =
246-
HttpClientBuilder.create()
247-
.setConnectionManager(connectionManager)
248-
.setDefaultRequestConfig(requestConfig)
249-
.build();
250-
251-
HttpTransport transport = new Apache5HttpTransport(httpClient, requestConfig, false);
252-
final GenericUrl url = new GenericUrl("http://localhost:" + server.getPort());
253-
254-
ExecutorService executor = Executors.newFixedThreadPool(2);
255-
256-
// First request takes the only connection
257-
executor.submit(
258-
() -> {
259-
try {
260-
transport.createRequestFactory().buildGetRequest(url).execute();
261-
} catch (IOException e) {
262-
// This request might fail if the test finishes before it completes, which is fine.
263-
}
264-
});
265-
266-
// Give the first request time to acquire the connection
267-
Thread.sleep(100);
268-
269-
// Second request should time out waiting for a connection
270-
try {
271-
transport.createRequestFactory().buildGetRequest(url).execute();
272-
fail("Should have thrown ConnectTimeoutException");
273-
} catch (ConnectTimeoutException e) {
274-
// Expected
275-
} finally {
276-
latch.countDown(); // Allow the first request to complete
277-
executor.shutdownNow();
278-
}
279-
}
280-
}
281-
282219
@Test(timeout = 5000)
283220
public void testConnectionRequestTimeoutFromDefaultRequestConfig() throws Exception {
284221
final CountDownLatch latch = new CountDownLatch(1);
@@ -332,7 +269,7 @@ public void handle(
332269
// Second request should time out waiting for a connection
333270
try {
334271
transport.createRequestFactory().buildGetRequest(url).execute();
335-
fail("Should have thrown ConnectTimeoutException");
272+
fail("Should have thrown ConnectionRequestTimeoutException");
336273
} catch (ConnectionRequestTimeoutException e) {
337274
// Expected
338275
} finally {

0 commit comments

Comments
 (0)