org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration Java Examples
The following examples show how to use
org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringWebSocketTest.java From java-specialagent with Apache License 2.0 | 6 votes |
@Test public void testInterceptors(final MockTracer tracer) { final DelegatingWebSocketMessageBrokerConfiguration configuration = new DelegatingWebSocketMessageBrokerConfiguration(); final AbstractSubscribableChannel inboundChannel = configuration.clientInboundChannel(); inboundChannel.setBeanName("clientInboundChannel"); final AbstractSubscribableChannel outboundChannel = configuration.clientOutboundChannel(); outboundChannel.setBeanName("clientOutboundChannel"); outboundChannel.subscribe(new SubProtocolWebSocketHandler(inboundChannel, outboundChannel)); inboundChannel.subscribe(new SubProtocolWebSocketHandler(inboundChannel, outboundChannel)); configuration.clientInboundChannelExecutor().initialize(); configuration.clientOutboundChannelExecutor().initialize(); final Map<String,Object> headers = Collections.<String,Object>singletonMap("simpMessageType", SimpMessageType.MESSAGE); final GenericMessage<String> message = new GenericMessage<>("test", headers); outboundChannel.send(message); inboundChannel.send(message); await().atMost(15, TimeUnit.SECONDS).until(TestUtil.reportedSpansSize(tracer), equalTo(2)); assertEquals(2, tracer.finishedSpans().size()); }