Java Code Examples for org.springframework.web.socket.sockjs.transport.session.TestHttpSockJsSession#delegateConnectionEstablished()
The following examples show how to use
org.springframework.web.socket.sockjs.transport.session.TestHttpSockJsSession#delegateConnectionEstablished() .
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: HttpReceivingTransportHandlerTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void delegateMessageException() throws Exception { StubSockJsServiceConfig sockJsConfig = new StubSockJsServiceConfig(); this.servletRequest.setContent("[\"x\"]".getBytes("UTF-8")); WebSocketHandler wsHandler = mock(WebSocketHandler.class); TestHttpSockJsSession session = new TestHttpSockJsSession("1", sockJsConfig, wsHandler, null); session.delegateConnectionEstablished(); willThrow(new Exception()).given(wsHandler).handleMessage(session, new TextMessage("x")); try { XhrReceivingTransportHandler transportHandler = new XhrReceivingTransportHandler(); transportHandler.initialize(sockJsConfig); transportHandler.handleRequest(this.request, this.response, wsHandler, session); fail("Expected exception"); } catch (SockJsMessageDeliveryException ex) { assertNull(session.getCloseStatus()); } }
Example 2
Source File: HttpReceivingTransportHandlerTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void delegateMessageException() throws Exception { StubSockJsServiceConfig sockJsConfig = new StubSockJsServiceConfig(); this.servletRequest.setContent("[\"x\"]".getBytes("UTF-8")); WebSocketHandler wsHandler = mock(WebSocketHandler.class); TestHttpSockJsSession session = new TestHttpSockJsSession("1", sockJsConfig, wsHandler, null); session.delegateConnectionEstablished(); willThrow(new Exception()).given(wsHandler).handleMessage(session, new TextMessage("x")); try { XhrReceivingTransportHandler transportHandler = new XhrReceivingTransportHandler(); transportHandler.initialize(sockJsConfig); transportHandler.handleRequest(this.request, this.response, wsHandler, session); fail("Expected exception"); } catch (SockJsMessageDeliveryException ex) { assertNull(session.getCloseStatus()); } }
Example 3
Source File: HttpReceivingTransportHandlerTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void delegateMessageException() throws Exception { StubSockJsServiceConfig sockJsConfig = new StubSockJsServiceConfig(); this.servletRequest.setContent("[\"x\"]".getBytes("UTF-8")); WebSocketHandler wsHandler = mock(WebSocketHandler.class); TestHttpSockJsSession session = new TestHttpSockJsSession("1", sockJsConfig, wsHandler, null); session.delegateConnectionEstablished(); willThrow(new Exception()).given(wsHandler).handleMessage(session, new TextMessage("x")); try { XhrReceivingTransportHandler transportHandler = new XhrReceivingTransportHandler(); transportHandler.initialize(sockJsConfig); transportHandler.handleRequest(this.request, this.response, wsHandler, session); fail("Expected exception"); } catch (SockJsMessageDeliveryException ex) { assertNull(session.getCloseStatus()); } }