List of usage examples for org.springframework.web.socket.adapter.standard StandardWebSocketSession StandardWebSocketSession
public StandardWebSocketSession(@Nullable HttpHeaders headers, @Nullable Map<String, Object> attributes,
@Nullable InetSocketAddress localAddress, @Nullable InetSocketAddress remoteAddress)
From source file:ch.rasc.wampspring.broker.SimpleBrokerMessageHandlerTests.java
@SuppressWarnings("resource") @Test/*from w ww.ja v a 2 s. c om*/ public void testCleanupMessage() { this.messageHandler.handleMessage(subscribeMessage("sess1", "/foo")); this.messageHandler.handleMessage(subscribeMessage("sess2", "/foo")); Session nativeSession = Mockito.mock(Session.class); Mockito.when(nativeSession.getId()).thenReturn("sess1"); StandardWebSocketSession wsSession = new StandardWebSocketSession(null, null, null, null); wsSession.initializeNativeSession(nativeSession); UnsubscribeMessage cleanupMessage = UnsubscribeMessage.createCleanupMessage(wsSession); this.messageHandler.handleMessage(cleanupMessage); this.messageHandler.handleMessage(eventMessage("sess1", "/foo", "message1")); this.messageHandler.handleMessage(eventMessage("sess2", "/bar", "message2")); verify(this.clientOutboundChannel, times(1)).send(this.messageCaptor.capture()); assertCapturedMessage(eventMessage("sess2", "/foo", "message1")); }