use of org.springframework.integration.websocket.inbound.WebSocketInboundChannelAdapter in project spring-integration by spring-projects.
the class WebSocketServerTests method testBrokerIsNotPresented.
@Test
public void testBrokerIsNotPresented() throws Exception {
WebSocketInboundChannelAdapter webSocketInboundChannelAdapter = new WebSocketInboundChannelAdapter(Mockito.mock(ServerWebSocketContainer.class));
webSocketInboundChannelAdapter.setOutputChannel(new DirectChannel());
webSocketInboundChannelAdapter.setUseBroker(true);
webSocketInboundChannelAdapter.setBeanFactory(Mockito.mock(BeanFactory.class));
webSocketInboundChannelAdapter.setApplicationContext(Mockito.mock(ApplicationContext.class));
try {
webSocketInboundChannelAdapter.afterPropertiesSet();
fail("IllegalStateException expected");
} catch (Exception e) {
assertThat(e, instanceOf(IllegalStateException.class));
assertThat(e.getMessage(), containsString("WebSocket Broker Relay isn't present in the application context;"));
}
}
use of org.springframework.integration.websocket.inbound.WebSocketInboundChannelAdapter in project faf-java-server by FAForever.
the class WebsocketAdapterConfig method webSocketInboundChannelAdapter.
/**
* WebSocket inbound adapter that accepts connections and messages from clients.
*/
@Bean
public WebSocketInboundChannelAdapter webSocketInboundChannelAdapter(IntegrationWebSocketContainer serverWebSocketContainer) {
WebSocketInboundChannelAdapter adapter = new WebSocketInboundChannelAdapter(serverWebSocketContainer, new SubProtocolHandlerRegistry(new FafSubProtocolHandler(clientConnectionService)));
adapter.setErrorChannelName(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME);
return adapter;
}
Aggregations