diff --git a/components/client/src/main/java/com/hotels/styx/client/connectionpool/SimpleConnectionPool.java b/components/client/src/main/java/com/hotels/styx/client/connectionpool/SimpleConnectionPool.java index 41f763386d..c9a6304b8e 100644 --- a/components/client/src/main/java/com/hotels/styx/client/connectionpool/SimpleConnectionPool.java +++ b/components/client/src/main/java/com/hotels/styx/client/connectionpool/SimpleConnectionPool.java @@ -100,7 +100,8 @@ Publisher borrowConnection2() { } } } - }).timeout(Duration.ofMillis(poolSettings.pendingConnectionTimeoutMillis()), + }).timeout( + Duration.ofMillis(poolSettings.pendingConnectionTimeoutMillis()), Mono.error(new MaxPendingConnectionTimeoutException(origin, connectionSettings.connectTimeoutMillis()))); } diff --git a/components/client/src/test/unit/java/com/hotels/styx/client/connectionpool/SimpleConnectionPoolTest.java b/components/client/src/test/unit/java/com/hotels/styx/client/connectionpool/SimpleConnectionPoolTest.java index 6f9edcf1a4..4b03509253 100644 --- a/components/client/src/test/unit/java/com/hotels/styx/client/connectionpool/SimpleConnectionPoolTest.java +++ b/components/client/src/test/unit/java/com/hotels/styx/client/connectionpool/SimpleConnectionPoolTest.java @@ -117,7 +117,7 @@ public void borrowsReturnedConnection() { @Test - public void emitsConnectionWhenOnceEstablished() throws ExecutionException, InterruptedException { + public void emitsConnectionWhenOnceEstablished() { PublishSubject subject = PublishSubject.create(); when(connectionFactory.createConnection(any(Origin.class), any(ConnectionSettings.class))) .thenReturn(subject); @@ -293,7 +293,6 @@ public void unsubscribingRemovesTheWaitingSubscriber() throws ExecutionException } - // 2. The connection pool limits @Test public void limitsPendingConnectionsDueToConnectionEstablishment() { when(connectionFactory.createConnection(any(Origin.class), any(ConnectionSettings.class))) @@ -307,8 +306,8 @@ public void limitsPendingConnectionsDueToConnectionEstablishment() { SimpleConnectionPool pool = new SimpleConnectionPool(origin, poolSettings, connectionFactory); - CompletableFuture pending1 = Mono.from(pool.borrowConnection2()).toFuture(); - CompletableFuture pending2 = Mono.from(pool.borrowConnection2()).toFuture(); + Mono.from(pool.borrowConnection2()).toFuture(); + Mono.from(pool.borrowConnection2()).toFuture(); StepVerifier.create(pool.borrowConnection2()) .expectError(MaxPendingConnectionsExceededException.class) @@ -319,7 +318,6 @@ public void limitsPendingConnectionsDueToConnectionEstablishment() { } - // 2. The connection pool limits @Test public void limitsPendingConnectionsDueToPoolSaturation() { when(connectionFactory.createConnection(any(Origin.class), any(ConnectionSettings.class))) @@ -362,7 +360,6 @@ public void limitsPendingConnectionsDueToPoolSaturation() { } - // 2. The connection pool limits @Test public void returnConnectionDecrementsConnectionCount() throws ExecutionException, InterruptedException, TimeoutException { when(connectionFactory.createConnection(any(Origin.class), any(ConnectionSettings.class))) @@ -627,7 +624,7 @@ public void borrowRetriesThreeTimesOnConnectionEstablishmentFailure() { } @Test - public void connectionEstablishmentFailureRetryThreeTimesAtConnectionClosure() { + public void borrowRetriesThreeTimesOnFailureDueToConnectionClosure() { when(connectionFactory.createConnection(any(Origin.class), any(ConnectionSettings.class))) .thenReturn(Observable.just(connection1)) .thenReturn(Observable.error(new OriginUnreachableException(origin, new RuntimeException()))) @@ -720,7 +717,7 @@ public void connectionEstablishmentFailureRetryThreeTimesOnlyAtConnectionClosure } @Test - public void pendingConnectionTimeout() { + public void emitsExceptionWhenPendingConnectionTimesOut() { PublishSubject subject = PublishSubject.create(); when(connectionFactory.createConnection(any(Origin.class), any(ConnectionSettings.class))) .thenReturn(subject);