Split messages only if configured to do so
See gh-31970
This commit is contained in:
@@ -66,6 +66,8 @@ class WebSocketStompClientIntegrationTests {
|
||||
|
||||
private AnnotationConfigWebApplicationContext wac;
|
||||
|
||||
private String url;
|
||||
|
||||
|
||||
@BeforeEach
|
||||
void setUp(TestInfo testInfo) throws Exception {
|
||||
@@ -83,6 +85,8 @@ class WebSocketStompClientIntegrationTests {
|
||||
WebSocketClient webSocketClient = new StandardWebSocketClient();
|
||||
this.stompClient = new WebSocketStompClient(webSocketClient);
|
||||
this.stompClient.setMessageConverter(new StringMessageConverter());
|
||||
|
||||
this.url = "ws://127.0.0.1:" + this.server.getPort() + "/stomp";
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
@@ -109,17 +113,30 @@ class WebSocketStompClientIntegrationTests {
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
void publishSubscribe() throws Exception {
|
||||
String url = "ws://127.0.0.1:" + this.server.getPort() + "/stomp";
|
||||
|
||||
TestHandler testHandler = new TestHandler("/topic/foo", "payload");
|
||||
this.stompClient.connect(url, testHandler);
|
||||
this.stompClient.connectAsync(this.url, testHandler);
|
||||
|
||||
assertThat(testHandler.awaitForMessageCount(1, 5000)).isTrue();
|
||||
assertThat(testHandler.getReceived()).containsExactly("payload");
|
||||
}
|
||||
|
||||
@Test
|
||||
void publishSubscribeWithSlitMessage() throws Exception {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (sb.length() < 1024) {
|
||||
sb.append("A message with a long body... ");
|
||||
}
|
||||
String payload = sb.toString();
|
||||
|
||||
TestHandler testHandler = new TestHandler("/topic/foo", payload);
|
||||
this.stompClient.setOutboundMessageSizeLimit(512);
|
||||
this.stompClient.connectAsync(this.url, testHandler);
|
||||
|
||||
assertThat(testHandler.awaitForMessageCount(1, 5000)).isTrue();
|
||||
assertThat(testHandler.getReceived()).containsExactly(payload);
|
||||
}
|
||||
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class TestConfig extends WebSocketMessageBrokerConfigurationSupport {
|
||||
|
||||
Reference in New Issue
Block a user