diff --git a/spring-integration-core/src/test/java/org/springframework/integration/gateway/AsyncGatewayTests.java b/spring-integration-core/src/test/java/org/springframework/integration/gateway/AsyncGatewayTests.java index 56fc565432..ba16838249 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/gateway/AsyncGatewayTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/gateway/AsyncGatewayTests.java @@ -110,7 +110,6 @@ public class AsyncGatewayTests { proxyFactory.afterPropertiesSet(); TestEchoService service = proxyFactory.getObject(); CompletableFuture> f = service.returnMessageListenable("foo"); - long start = System.currentTimeMillis(); final AtomicReference> result = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); f.whenComplete((message, throwable) -> { @@ -120,8 +119,6 @@ public class AsyncGatewayTests { } }); assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue(); - long elapsed = System.currentTimeMillis() - start; - assertThat(elapsed >= 200).isTrue(); assertThat(result.get().getPayload()).isEqualTo("foobar"); Object thread = result.get().getHeaders().get("thread"); assertThat(thread).isNotEqualTo(Thread.currentThread()); @@ -363,13 +360,7 @@ public class AsyncGatewayTests { Message reply = MessageBuilder.withPayload(payload) .copyHeaders(input.getHeaders()) .build(); - try { - Thread.sleep(200); - } - catch (InterruptedException e) { - Thread.currentThread().interrupt(); - return; - } + String header = (String) input.getHeaders().get("method"); if (header != null && header.startsWith("returnCustomFuture")) { reply = MessageBuilder.withPayload(new CustomFuture(payload,