diff --git a/java-compute/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/integration/ITHeadersTest.java b/java-compute/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/integration/ITHeadersTest.java index c827d19af6e1..d96e33be85f4 100644 --- a/java-compute/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/integration/ITHeadersTest.java +++ b/java-compute/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/integration/ITHeadersTest.java @@ -73,19 +73,14 @@ public static void tearDown() { } @Test - public void testHeaders() { + public void testHeaders() throws TimeoutException, ExecutionException, InterruptedException { OperationFuture future = addressesClient.insertAsync( "testProject", "testRegion", Address.newBuilder().setName("testName").build()); - try { - future.get(5, TimeUnit.SECONDS); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } catch (TimeoutException e) { - ; // expected - } - future.cancel(true); + future.get(30, TimeUnit.SECONDS); + + Assert.assertNotNull("Server did not process request headers.", headers); List clientIdentificationHeader = headers.get("X-goog-api-client"); Assert.assertNotNull( "X-goog-api-client header missing. Headers found: " + String.join(", ", headers.keySet()),