use of org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator in project spring-framework by spring-projects.
the class OrderedMessageSendingIntegrationTests method exceedBufferSizeLimit.
@Test
void exceedBufferSizeLimit() throws InterruptedException {
ConcurrentWebSocketSessionDecorator concurrentSessionDecorator = new ConcurrentWebSocketSessionDecorator(this.blockingSession, 60 * 1000, 2 * MESSAGE_SIZE);
TestMessageHandler messageHandler = new TestMessageHandler(concurrentSessionDecorator);
subscribableChannel.subscribe(messageHandler);
// Send one to block
this.orderedMessageChannel.send(createMessage(0));
int messageCount = 3;
CountDownLatch messageLatch = new CountDownLatch(messageCount);
messageHandler.setMessageLatch(messageLatch);
for (int i = 1; i <= messageCount; i++) {
this.orderedMessageChannel.send(createMessage(i));
}
messageLatch.await(5, TimeUnit.SECONDS);
assertThat(messageHandler.getSavedException()).hasMessage("Buffer size " + 3 * MESSAGE_SIZE + " bytes for session '1' exceeds the allowed limit " + 2 * MESSAGE_SIZE);
}
Aggregations