Skip to content

Commit 41cb6ae

Browse files
Meijuhsbrannen
authored andcommitted
Add getter for OverflowStrategy in ConcurrentWebSocketSessionDecorator
This commit also includes a test for all configured properties. Closes gh-35132 Signed-off-by: Jeroen Meijer <[email protected]>
1 parent 55634f9 commit 41cb6ae

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,13 @@ public void close(CloseStatus status) throws IOException {
276276
}
277277
}
278278

279+
/**
280+
* Return the configured overflow strategy.
281+
* @since 6.3
282+
*/
283+
public OverflowStrategy getOverflowStrategy() {
284+
return this.overflowStrategy;
285+
}
279286

280287
@Override
281288
public String toString() {

spring-websocket/src/test/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecoratorTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,14 @@ private void sendBlockingMessage(ConcurrentWebSocketSessionDecorator session) th
215215
assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue();
216216
}
217217

218+
@Test
219+
void configuredProperties() {
220+
TestWebSocketSession session = new TestWebSocketSession();
221+
ConcurrentWebSocketSessionDecorator sessionDecorator = new ConcurrentWebSocketSessionDecorator(session, 42, 43, OverflowStrategy.DROP);
222+
223+
assertThat(sessionDecorator.getSendTimeLimit()).isEqualTo(42);
224+
assertThat(sessionDecorator.getBufferSizeLimit()).isEqualTo(43);
225+
assertThat(sessionDecorator.getOverflowStrategy()).isEqualTo(OverflowStrategy.DROP);
226+
}
227+
218228
}

0 commit comments

Comments
 (0)