Package org.springframework.web.socket.handler

Examples of org.springframework.web.socket.handler.TextWebSocketHandler


    if (wsSession == null) {

      final CountDownLatch latch = new CountDownLatch(1);

      TextWebSocketHandler webSocketHandler = new TextWebSocketHandler() {

        @Override
        public void afterConnectionEstablished(
            WebSocketSession wsSession2) throws Exception {
View Full Code Here


  @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

  @Test
  public void subProtocolNegotiation() throws Exception {
    WebSocketHttpHeaders headers = new WebSocketHttpHeaders();
    headers.setSecWebSocketProtocol("foo");
    URI url = new URI(getWsBaseUrl() + "/ws");
    WebSocketSession session = this.webSocketClient.doHandshake(new TextWebSocketHandler(), headers, url).get();
    assertEquals("foo", session.getAcceptedProtocol());
  }
View Full Code Here

      registry.addHandler(handler(), "/ws").setHandshakeHandler(this.handshakeHandler);
    }

    @Bean
    public TextWebSocketHandler handler() {
      return new TextWebSocketHandler();
    }
View Full Code Here

    verifyNoMoreInteractions(this.taskScheduler, this.webSocketHandler);
  }

  @Test
  public void afterSessionInitializedOpenFrameFirst() throws Exception {
    TextWebSocketHandler handler = new TextWebSocketHandler() {
      @Override
      public void afterConnectionEstablished(WebSocketSession session) throws Exception {
        session.sendMessage(new TextMessage("go go"));
      }
    };
View Full Code Here

    assertEquals(stompHandler.getSupportedProtocols(), sockJsHandler.getSubProtocols());
  }

  @Test
  public void getSubProtocolsNone() throws Exception {
    WebSocketHandler handler = new TextWebSocketHandler();
    TaskScheduler scheduler = mock(TaskScheduler.class);
    DefaultSockJsService service = new DefaultSockJsService(scheduler);
    WebSocketServerSockJsSession session = new WebSocketServerSockJsSession("1", service, handler, null);
    SockJsWebSocketHandler sockJsHandler = new SockJsWebSocketHandler(service, handler, session);
View Full Code Here

  @Before
  public void setup() throws Exception {

    int port = SocketUtils.findAvailableTcpPort();

    this.server = new TestJettyWebSocketServer(port, new TextWebSocketHandler());
    this.server.start();

    this.client = new JettyWebSocketClient();
    this.client.start();
View Full Code Here

TOP

Related Classes of org.springframework.web.socket.handler.TextWebSocketHandler

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.