Fix WebSocket tests the same way as STOMP before

See https://jira.spring.io/browse/INT-3888 and its PullRequest

Note: rework `StompIntegrationTests` logic to use SockJS Client (that was enabled on the server side before).
This helps us to use `sessionId` which is as a `user` key on subscription phase.
In case of Standard Tomcat WebSocket Client we end up with the race condition when both client and server uses the same
`static` variable in the `WsSession` class, so we can't determine the server session correctly by the id on the client side.
The subscribe/send/unsubscribe logic works well because we are based on the **web socket** for the session, independently of its id.
This commit is contained in:
Artem Bilan
2015-11-19 18:11:35 -05:00
parent 73bc3fedf5
commit e55a7b8234
2 changed files with 28 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -181,10 +181,7 @@ public abstract class IntegrationWebSocketContainer implements DisposableBean {
@Override
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
WebSocketSession removed = IntegrationWebSocketContainer.this.sessions.remove(session.getId());
if (removed != null) {
IntegrationWebSocketContainer.this.sessions.remove(session.getId());
}
IntegrationWebSocketContainer.this.sessions.remove(session.getId());
throw new Exception(exception);
}