|
|
|
@ -25,6 +25,7 @@ import java.time.Duration;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.concurrent.ArrayBlockingQueue;
|
|
|
|
|
import java.util.concurrent.BlockingQueue;
|
|
|
|
|
import java.util.concurrent.BrokenBarrierException;
|
|
|
|
|
import java.util.concurrent.Callable;
|
|
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
|
|
import java.util.concurrent.Future;
|
|
|
|
@ -423,6 +424,25 @@ public abstract class AbstractReactiveWebServerFactoryTests {
|
|
|
|
|
assertThat(responseLatch.await(5, TimeUnit.SECONDS)).isTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void whenARequestIsActiveThenStopWillComplete() throws InterruptedException, BrokenBarrierException {
|
|
|
|
|
AbstractReactiveWebServerFactory factory = getFactory();
|
|
|
|
|
BlockingHandler blockingHandler = new BlockingHandler();
|
|
|
|
|
this.webServer = factory.getWebServer(blockingHandler);
|
|
|
|
|
this.webServer.start();
|
|
|
|
|
Mono<ResponseEntity<Void>> request = getWebClient(this.webServer.getPort()).build().get().retrieve()
|
|
|
|
|
.toBodilessEntity();
|
|
|
|
|
AtomicReference<ResponseEntity<Void>> responseReference = new AtomicReference<>();
|
|
|
|
|
CountDownLatch responseLatch = new CountDownLatch(1);
|
|
|
|
|
request.subscribe((response) -> {
|
|
|
|
|
responseReference.set(response);
|
|
|
|
|
responseLatch.countDown();
|
|
|
|
|
});
|
|
|
|
|
blockingHandler.awaitQueue();
|
|
|
|
|
this.webServer.stop();
|
|
|
|
|
blockingHandler.completeOne();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected WebClient prepareCompressionTest() {
|
|
|
|
|
Compression compression = new Compression();
|
|
|
|
|
compression.setEnabled(true);
|
|
|
|
|