diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/JavaxWebSocketChat.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/JavaxWebSocketChat.java index c8be36c97b2..4a4090eba1e 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/JavaxWebSocketChat.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/JavaxWebSocketChat.java @@ -31,7 +31,7 @@ import javax.websocket.RemoteEndpoint; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint; -@ServerEndpoint(value="/javax.websocket/") +@ServerEndpoint(value="/javax.websocket/", subprotocols={"chat"}) public class JavaxWebSocketChat { private static final List members = new CopyOnWriteArrayList<>(); diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/WebSocketChatServlet.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/WebSocketChatServlet.java index 1f9f3859edf..9b990f0742f 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/WebSocketChatServlet.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/WebSocketChatServlet.java @@ -73,7 +73,12 @@ public class WebSocketChatServlet extends WebSocketServlet implements WebSocketC @Override public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) { - return new ChatWebSocket(); + if (req.hasSubProtocol("chat")) + { + resp.setAcceptedSubProtocol("chat"); + return new ChatWebSocket(); + } + return null; } @Override