Work around Jetty websocket client bug
Add workaround for Jetty JsrSession NullPointerException bug (https://github.com/eclipse/jetty.project/issues/1202) in `spring-boot-sample-websocket-jetty`. See gh-7599
This commit is contained in:
@@ -22,9 +22,11 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.eclipse.jetty.websocket.jsr356.ClientContainer;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import samples.websocket.jetty.SampleJettyWebSocketsApplication;
|
||||
import samples.websocket.jetty.client.FixedClientContainer;
|
||||
import samples.websocket.jetty.client.GreetingService;
|
||||
import samples.websocket.jetty.client.SimpleClientWebSocketHandler;
|
||||
import samples.websocket.jetty.client.SimpleGreetingService;
|
||||
@@ -123,18 +125,18 @@ public class CustomContainerWebSocketsApplicationTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebSocketConnectionManager wsConnectionManager() {
|
||||
|
||||
public WebSocketConnectionManager wsConnectionManager() throws Exception {
|
||||
WebSocketConnectionManager manager = new WebSocketConnectionManager(client(),
|
||||
handler(), this.webSocketUri);
|
||||
manager.setAutoStartup(true);
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public StandardWebSocketClient client() {
|
||||
return new StandardWebSocketClient();
|
||||
public StandardWebSocketClient client() throws Exception {
|
||||
ClientContainer container = new FixedClientContainer();
|
||||
container.start();
|
||||
return new StandardWebSocketClient(container);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user