use of org.springframework.web.socket.messaging.SubProtocolHandler in project spring-framework by spring-projects.
the class WebMvcStompEndpointRegistryTests method errorHandler.
@Test
public void errorHandler() throws Exception {
StompSubProtocolErrorHandler errorHandler = mock(StompSubProtocolErrorHandler.class);
this.endpointRegistry.setErrorHandler(errorHandler);
this.endpointRegistry.addEndpoint("/stompOverWebSocket");
Map<String, SubProtocolHandler> protocolHandlers = this.webSocketHandler.getProtocolHandlerMap();
StompSubProtocolHandler stompHandler = (StompSubProtocolHandler) protocolHandlers.get("v12.stomp");
assertThat(stompHandler.getErrorHandler()).isSameAs(errorHandler);
}
use of org.springframework.web.socket.messaging.SubProtocolHandler in project spring-framework by spring-projects.
the class WebSocketMessageBrokerConfigurationSupportTests method webSocketHandler.
@Test
void webSocketHandler() {
ApplicationContext context = createContext(TestChannelConfig.class, TestConfigurer.class);
SubProtocolWebSocketHandler subWsHandler = context.getBean(SubProtocolWebSocketHandler.class);
assertThat(subWsHandler.getSendBufferSizeLimit()).isEqualTo(1024 * 1024);
assertThat(subWsHandler.getSendTimeLimit()).isEqualTo(25 * 1000);
assertThat(subWsHandler.getTimeToFirstMessage()).isEqualTo(30 * 1000);
Map<String, SubProtocolHandler> handlerMap = subWsHandler.getProtocolHandlerMap();
StompSubProtocolHandler protocolHandler = (StompSubProtocolHandler) handlerMap.get("v12.stomp");
assertThat(protocolHandler.getMessageSizeLimit()).isEqualTo(128 * 1024);
}
Aggregations