Refine invocation of checkSessions

It makes more sense to call this from afterConnectionEstablished as it
relates to the creation of new sessions.

See gh-32195
This commit is contained in:
rstoyanchev
2024-02-12 12:50:45 +00:00
parent 2e833d908a
commit 5851cdc679
2 changed files with 17 additions and 10 deletions

View File

@@ -182,13 +182,18 @@ public class SubProtocolWebSocketHandlerTests {
this.webSocketHandler.start();
this.webSocketHandler.handleMessage(session1, new TextMessage("foo"));
TestWebSocketSession session3 = new TestWebSocketSession("id3");
session3.setOpen(true);
session3.setAcceptedProtocol("v12.stomp");
this.webSocketHandler.afterConnectionEstablished(session1);
assertThat(session1.isOpen()).isTrue();
assertThat(session1.getCloseStatus()).isNull();
assertThat(session2.isOpen()).isFalse();
assertThat(session2.getCloseStatus()).isEqualTo(CloseStatus.SESSION_NOT_RELIABLE);
assertThat(handlerAccessor.getPropertyValue("lastSessionCheckTime")).as("lastSessionCheckTime not updated").isNotEqualTo(sixtyOneSecondsAgo);
assertThat(handlerAccessor.getPropertyValue("lastSessionCheckTime")).isNotEqualTo(sixtyOneSecondsAgo);
}
}