本文整理汇总了Java中org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator类的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentWebSocketSessionDecorator类的具体用法?Java ConcurrentWebSocketSessionDecorator怎么用?Java ConcurrentWebSocketSessionDecorator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConcurrentWebSocketSessionDecorator类属于org.springframework.web.socket.handler包,在下文中一共展示了ConcurrentWebSocketSessionDecorator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterConnectionEstablished
import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; //导入依赖的package包/类
@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
ConcurrentWebSocketSessionDecorator decorator =
new ConcurrentWebSocketSessionDecorator(session, sendTimeLimit, bufferSizeLimit);
sessions.put(session.getId(), decorator);
this.onOpen(decorator);
}
示例2: subProtocolMatch
import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; //导入依赖的package包/类
@Test
public void subProtocolMatch() throws Exception {
this.webSocketHandler.setProtocolHandlers(Arrays.asList(stompHandler, mqttHandler));
this.session.setAcceptedProtocol("v12.sToMp");
this.webSocketHandler.afterConnectionEstablished(session);
verify(this.stompHandler).afterSessionStarted(
isA(ConcurrentWebSocketSessionDecorator.class), eq(this.inClientChannel));
verify(this.mqttHandler, times(0)).afterSessionStarted(session, this.inClientChannel);
}
示例3: subProtocolDefaultHandlerOnly
import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; //导入依赖的package包/类
@Test
public void subProtocolDefaultHandlerOnly() throws Exception {
this.webSocketHandler.setDefaultProtocolHandler(stompHandler);
this.session.setAcceptedProtocol("v12.sToMp");
this.webSocketHandler.afterConnectionEstablished(session);
verify(this.stompHandler).afterSessionStarted(
isA(ConcurrentWebSocketSessionDecorator.class), eq(this.inClientChannel));
}
示例4: nullSubProtocol
import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; //导入依赖的package包/类
@Test
public void nullSubProtocol() throws Exception {
this.webSocketHandler.setDefaultProtocolHandler(defaultHandler);
this.webSocketHandler.afterConnectionEstablished(session);
verify(this.defaultHandler).afterSessionStarted(
isA(ConcurrentWebSocketSessionDecorator.class), eq(this.inClientChannel));
verify(this.stompHandler, times(0)).afterSessionStarted(session, this.inClientChannel);
verify(this.mqttHandler, times(0)).afterSessionStarted(session, this.inClientChannel);
}
示例5: emptySubProtocol
import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; //导入依赖的package包/类
@Test
public void emptySubProtocol() throws Exception {
this.session.setAcceptedProtocol("");
this.webSocketHandler.setDefaultProtocolHandler(this.defaultHandler);
this.webSocketHandler.afterConnectionEstablished(session);
verify(this.defaultHandler).afterSessionStarted(
isA(ConcurrentWebSocketSessionDecorator.class), eq(this.inClientChannel));
verify(this.stompHandler, times(0)).afterSessionStarted(session, this.inClientChannel);
verify(this.mqttHandler, times(0)).afterSessionStarted(session, this.inClientChannel);
}
示例6: noSubProtocolOneHandler
import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; //导入依赖的package包/类
@Test
public void noSubProtocolOneHandler() throws Exception {
this.webSocketHandler.setProtocolHandlers(Arrays.asList(stompHandler));
this.webSocketHandler.afterConnectionEstablished(session);
verify(this.stompHandler).afterSessionStarted(
isA(ConcurrentWebSocketSessionDecorator.class), eq(this.inClientChannel));
}
示例7: internalGet
import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; //导入依赖的package包/类
private ConcurrentWebSocketSessionDecorator internalGet(WebSocketSession session) {
ConcurrentWebSocketSessionDecorator decorator = sessions.get(session.getId());
if (decorator == null) {
throw new NoSuchElementException();
}
return decorator;
}
示例8: afterConnectionClosed
import org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator; //导入依赖的package包/类
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
ConcurrentWebSocketSessionDecorator decorator = sessions.remove(session.getId());
this.onClose(decorator, closeStatus);
}