@Test
  public void sockJsAttributesSupport() {
    loadBeanDefinitions("websocket-config-handlers-sockjs-attributes.xml");
    SimpleUrlHandlerMapping handlerMapping = appContext.getBean(SimpleUrlHandlerMapping.class);
    assertNotNull(handlerMapping);
    SockJsHttpRequestHandler handler =
        (SockJsHttpRequestHandler) handlerMapping.getUrlMap().get("/test/**");
    assertNotNull(handler);
    checkDelegateHandlerType(handler.getWebSocketHandler(), TestWebSocketHandler.class);
    SockJsService sockJsService = handler.getSockJsService();
    assertNotNull(sockJsService);
    assertThat(sockJsService, Matchers.instanceOf(TransportHandlingSockJsService.class));
    TransportHandlingSockJsService defaultSockJsService =
        (TransportHandlingSockJsService) sockJsService;
    assertThat(
        defaultSockJsService.getTaskScheduler(), Matchers.instanceOf(TestTaskScheduler.class));
    assertThat(
        defaultSockJsService.getTransportHandlers().values(),
        Matchers.containsInAnyOrder(
            Matchers.instanceOf(XhrPollingTransportHandler.class),
            Matchers.instanceOf(XhrStreamingTransportHandler.class)));

    assertEquals("testSockJsService", defaultSockJsService.getName());
    assertFalse(defaultSockJsService.isWebSocketEnabled());
    assertFalse(defaultSockJsService.isSessionCookieNeeded());
    assertEquals(2048, defaultSockJsService.getStreamBytesLimit());
    assertEquals(256, defaultSockJsService.getDisconnectDelay());
    assertEquals(1024, defaultSockJsService.getHttpMessageCacheSize());
    assertEquals(20, defaultSockJsService.getHeartbeatTime());
  }
  @Test
  public void handleTransportRequestXhr() throws Exception {
    String sockJsPath = sessionUrlPrefix + "xhr";
    setRequest("POST", sockJsPrefix + sockJsPath);
    this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);

    assertEquals(200, this.servletResponse.getStatus());
    verify(this.xhrHandler)
        .handleRequest(this.request, this.response, this.wsHandler, this.session);
    verify(taskScheduler)
        .scheduleAtFixedRate(any(Runnable.class), eq(service.getDisconnectDelay()));

    assertEquals(
        "no-store, no-cache, must-revalidate, max-age=0",
        this.response.getHeaders().getCacheControl());
    assertNull(this.response.getHeaders().getFirst("Access-Control-Allow-Origin"));
    assertNull(this.response.getHeaders().getFirst("Access-Control-Allow-Credentials"));
  }