fix/websocket-handler-close-client #473
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixed 4 failing WebSocket handler close tests that were expecting SpringWebSocketClient.close() to be called when subscription handles are closed. The tests were failing because the
client cleanup wasn't happening in SubscriptionHandle.close(), and the test infrastructure couldn't handle concurrent subscriptions sharing underlying WebSocket connections.
This change ensures proper resource cleanup when subscriptions are closed, while gracefully handling scenarios where multiple SpringWebSocketClient instances share the same underlying
WebSocket connection (common in test environments).
Related issue: N/A (fixes failing tests in develop branch)
What changed?
3 files changed, 7 insertions(+), 5 deletions(-)
Start reviewing: WebSocketClientHandler.java:178-188 (the SubscriptionHandle.close() method)
BREAKING
None. This is a bug fix that makes the implementation match the test expectations. No public API changes.
Review focus
consider reference counting instead?
Checklist
Test Results
All 151 tests pass, including the 4 previously failing tests: