From aef9792022f06f4e52f55e2606690545863533ba Mon Sep 17 00:00:00 2001 From: Jeroen Meijer Date: Mon, 30 Jun 2025 15:05:31 +0200 Subject: [PATCH] Add getter for overflow strategy Also include test for all configured properties. Signed-off-by: Jeroen Meijer --- .../handler/ConcurrentWebSocketSessionDecorator.java | 7 +++++++ .../ConcurrentWebSocketSessionDecoratorTests.java | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java b/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java index c5fe7f852691..bcc478ca47c5 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java @@ -275,6 +275,13 @@ public void close(CloseStatus status) throws IOException { } } + /** + * Return the configured overflow strategy. + * @since 6.3 + */ + public OverflowStrategy getOverflowStrategy() { + return this.overflowStrategy; + } @Override public String toString() { diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java index 8f8b595e81f6..da08400d94ac 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java @@ -215,4 +215,14 @@ private void sendBlockingMessage(ConcurrentWebSocketSessionDecorator session) th assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); } + @Test + void configuredProperties() { + TestWebSocketSession session = new TestWebSocketSession(); + ConcurrentWebSocketSessionDecorator sessionDecorator = new ConcurrentWebSocketSessionDecorator(session, 42, 43, OverflowStrategy.DROP); + + assertThat(sessionDecorator.getSendTimeLimit()).isEqualTo(42); + assertThat(sessionDecorator.getBufferSizeLimit()).isEqualTo(43); + assertThat(sessionDecorator.getOverflowStrategy()).isEqualTo(OverflowStrategy.DROP); + } + }