Package org.springframework.web.socket

Examples of org.springframework.web.socket.WebSocketHandler


  @Test
  public void openConnection() throws Exception {
    List<String> subprotocols = Arrays.asList("abc");

    TestLifecycleWebSocketClient client = new TestLifecycleWebSocketClient(false);
    WebSocketHandler handler = new TextWebSocketHandler();

    WebSocketConnectionManager manager = new WebSocketConnectionManager(client, handler , "/path/{id}", "123");
    manager.setSubProtocols(subprotocols);
    manager.openConnection();
View Full Code Here


  }

  @Test
  public void clientLifecycle() throws Exception {
    TestLifecycleWebSocketClient client = new TestLifecycleWebSocketClient(false);
    WebSocketHandler handler = new TextWebSocketHandler();
    WebSocketConnectionManager manager = new WebSocketConnectionManager(client, handler , "/a");

    manager.startInternal();
    assertTrue(client.isRunning());
View Full Code Here

    headers.setConnection("Upgrade");
    headers.setSecWebSocketVersion("13");
    headers.setSecWebSocketKey("82/ZS2YHjEnUN97HLL8tbw==");
    headers.setSecWebSocketProtocol("STOMP");

    WebSocketHandler handler = new TextWebSocketHandler();
    Map<String, Object> attributes = Collections.<String, Object>emptyMap();
    this.handshakeHandler.doHandshake(this.request, this.response, handler, attributes);

    verify(this.upgradeStrategy).upgrade(this.request, this.response,
        "STOMP", Collections.<WebSocketExtension>emptyList(), null, handler, attributes);
View Full Code Here

    headers.setConnection("Upgrade");
    headers.setSecWebSocketVersion("13");
    headers.setSecWebSocketKey("82/ZS2YHjEnUN97HLL8tbw==");
    headers.setSecWebSocketExtensions(Arrays.asList(extension1, extension2));

    WebSocketHandler handler = new TextWebSocketHandler();
    Map<String, Object> attributes = Collections.<String, Object>emptyMap();
    this.handshakeHandler.doHandshake(this.request, this.response, handler, attributes);

    verify(this.upgradeStrategy).upgrade(this.request, this.response, null, Arrays.asList(extension1),
        null, handler, attributes);
View Full Code Here

    headers.setConnection("Upgrade");
    headers.setSecWebSocketVersion("13");
    headers.setSecWebSocketKey("82/ZS2YHjEnUN97HLL8tbw==");
    headers.setSecWebSocketProtocol("v11.stomp");

    WebSocketHandler handler = new SubProtocolCapableHandler("v12.stomp", "v11.stomp");
    Map<String, Object> attributes = Collections.<String, Object>emptyMap();
    this.handshakeHandler.doHandshake(this.request, this.response, handler, attributes);

    verify(this.upgradeStrategy).upgrade(this.request, this.response,
        "v11.stomp", Collections.<WebSocketExtension>emptyList(), null, handler, attributes);
View Full Code Here

    headers.setConnection("Upgrade");
    headers.setSecWebSocketVersion("13");
    headers.setSecWebSocketKey("82/ZS2YHjEnUN97HLL8tbw==");
    headers.setSecWebSocketProtocol("v10.stomp");

    WebSocketHandler handler = new SubProtocolCapableHandler("v12.stomp", "v11.stomp");
    Map<String, Object> attributes = Collections.<String, Object>emptyMap();
    this.handshakeHandler.doHandshake(this.request, this.response, handler, attributes);

    verify(this.upgradeStrategy).upgrade(this.request, this.response,
        null, Collections.<WebSocketExtension>emptyList(), null, handler, attributes);
View Full Code Here


  @Test
  public void defaultConstructor() throws Exception {
    Map<String, Object> attributes = new HashMap<String, Object>();
    WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);

    this.servletRequest.setSession(new MockHttpSession(null, "123"));
    this.servletRequest.getSession().setAttribute("foo", "bar");
    this.servletRequest.getSession().setAttribute("bar", "baz");
View Full Code Here

  }

  @Test
  public void constructorWithAttributeNames() throws Exception {
    Map<String, Object> attributes = new HashMap<String, Object>();
    WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);

    this.servletRequest.setSession(new MockHttpSession(null, "123"));
    this.servletRequest.getSession().setAttribute("foo", "bar");
    this.servletRequest.getSession().setAttribute("bar", "baz");
View Full Code Here

  }

  @Test
  public void doNotCopyHttpSessionId() throws Exception {
    Map<String, Object> attributes = new HashMap<String, Object>();
    WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);

    this.servletRequest.setSession(new MockHttpSession(null, "123"));
    this.servletRequest.getSession().setAttribute("foo", "bar");

    HttpSessionHandshakeInterceptor interceptor = new HttpSessionHandshakeInterceptor();
View Full Code Here


  @Test
  public void doNotCopyAttributes() throws Exception {
    Map<String, Object> attributes = new HashMap<String, Object>();
    WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class);

    this.servletRequest.setSession(new MockHttpSession(null, "123"));
    this.servletRequest.getSession().setAttribute("foo", "bar");

    HttpSessionHandshakeInterceptor interceptor = new HttpSessionHandshakeInterceptor();
View Full Code Here

TOP

Related Classes of org.springframework.web.socket.WebSocketHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.