luigidemasi commented on code in PR #28237:
URL: https://github.com/apache/camel/pull/28237#discussion_r4347108027


##########
components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelWebSocketHandler.java:
##########
@@ -403,12 +408,30 @@ public void setConsumer(UndertowConsumer consumer, 
HttpHandler consumerHandler)
                         = new ConsumerHandlers(
                                 consumer.getEndpoint(), consumerHandler != 
null ? consumerHandler : upgradeHandler);
                 producerEndpoints.forEach(this::warnIfProducerSettingsUnused);
+                closePeersThatNoLongerPassChecks();

Review Comment:
   **P2 — Adjust the remaining window tests for proactive closure.**
   
   This new close step also affects the two window tests in 
[`UndertowWsSecurityWithoutProviderTest`](https://github.com/apache/camel/blob/e26aaed4b1228147e0f43fda256e879bf564370a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsSecurityWithoutProviderTest.java#L121).
 Both still call `webSocket.sendText("hello", true).join()` after 
`startRoute(...)`, requiring a successful write even though the server can 
already have closed that connection.
   
   At this exact head, 
`connectionOpenedBeforeAConsumerWithHandlersStartedIsNotServed` failed at line 
150 with `CompletionException: java.io.IOException: Output closed` on the 
initial module run and both retries. 
`connectionOpenedBeforeTheConsumerStartedIsNotServed` has the same assumption 
at line 131. The OAuth window test was adjusted for this race in this commit; 
these two methods need the same treatment.
   
   Please replace the send in **both methods** with a bounded, best-effort 
send, keeping the existing `1008`, no-delivery and route-invocation assertions:
   
   ```java
   // The consumer may already have closed this stale connection; sending is 
best effort.
   webSocket.sendText("hello", true)
           .orTimeout(5, TimeUnit.SECONDS)
           .handle((result, error) -> null)
           .join();
   ```
   
   With only those two send adjustments applied temporarily, the full Undertow 
suite passed: 238 tests, zero failures/errors, one skipped. The production 
change was left intact during that verification.
   
   _AI-generated review by Codex on behalf of @luigidemasi._



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to