INT-4345: ServerWebSocketContainer: Fix Lifecycle

JIRA: https://jira.spring.io/browse/INT-4345

Resolves https://github.com/spring-projects/spring-integration/issues/2238

The `DefaultHandshakeHandler` doesn't implement `SmartLifecycle`
(just `Lifecycle`) there it doesn't delegate its `start()` to the
`RequestUpgradeStrategy`, e.g. `JettyRequestUpgradeStrategy`.
On the other hand `DefaultHandshakeHandler` can be started as a dependant
`Lifecycle` from some other `SmartLifecycle`, like it happens with the
`WebSocketHandlerMapping`

* Implement `SmartLifecycle` for the `ServerWebSocketContainer` and
delegate its lifecycle to the provided `HandshakeHandler`
* Fix `WebSocketInboundChannelAdapter` to properly implement `doStop()`
with the propagation to the provided `webSocketContainer`
* Fix deprecation warning in the `StompMessageHandlerWebSocketIntegrationTests`

**Cherry-pick to 4.3.x**
This commit is contained in:
Artem Bilan
2017-09-27 17:33:41 -04:00
committed by Gary Russell
parent 077b5ffffc
commit bf1fef39db
4 changed files with 102 additions and 3 deletions

View File

@@ -91,6 +91,7 @@ import org.springframework.web.socket.sockjs.client.WebSocketTransport;
/**
* @author Artem Bilan
* @author Gary Russell
*
* @since 4.2
*/
@ContextConfiguration(classes = StompMessageHandlerWebSocketIntegrationTests.ContextConfiguration.class)
@@ -269,7 +270,7 @@ public class StompMessageHandlerWebSocketIntegrationTests extends LogAdjustingTe
@Override
public void configureClientInboundChannel(ChannelRegistration registration) {
registration.setInterceptors(new ChannelInterceptorAdapter() {
registration.interceptors(new ChannelInterceptorAdapter() {
private final AtomicBoolean invoked = new AtomicBoolean();