diff --git a/jetty-websocket/javax-websocket-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler.java b/jetty-websocket/javax-websocket-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler.java
index 033cc270aa2..8356e064163 100644
--- a/jetty-websocket/javax-websocket-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler.java
+++ b/jetty-websocket/javax-websocket-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler.java
@@ -545,13 +545,7 @@ public class JavaxWebSocketFrameHandler implements FrameHandler
public void onPing(Frame frame, Callback callback)
{
- ByteBuffer payload = BufferUtil.EMPTY_BUFFER;
-
- if (frame.hasPayload())
- {
- payload = ByteBuffer.allocate(frame.getPayloadLength());
- BufferUtil.put(frame.getPayload(), payload);
- }
+ ByteBuffer payload = BufferUtil.copy(frame.getPayload());
coreSession.sendFrame(new Frame(OpCode.PONG).setPayload(payload), Callback.NOOP, false);
callback.succeeded();
}
diff --git a/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/config/ContainerDefaultConfigurator.java b/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/config/ContainerDefaultConfigurator.java
index 9906438cc3f..4a5ac1bb7e6 100644
--- a/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/config/ContainerDefaultConfigurator.java
+++ b/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/config/ContainerDefaultConfigurator.java
@@ -18,6 +18,7 @@
package org.eclipse.jetty.websocket.javax.server.config;
+import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;
import javax.websocket.Extension;
@@ -28,6 +29,7 @@ import javax.websocket.server.ServerEndpointConfig.Configurator;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
+import org.eclipse.jetty.websocket.core.ExtensionConfig;
/**
* The "Container Default Configurator" per the JSR-356 spec.
@@ -78,7 +80,16 @@ public final class ContainerDefaultConfigurator extends Configurator
@Override
public List
+ * Installing Autobahn:
+ *
+ * Upgrading an existing installation of autobahntestsuite
+ *
+ * Running Autobahn Fuzzing Server (which you run this client implementation against):
+ *
+ * Installing Autobahn:
+ *
+ * Upgrading an existing installation of autobahntestsuite
+ *
+ * Running Autobahn Fuzzing Client (against this server implementation):
+ *
+ * WebSocket Frames over this maximum will result in a close code 1009 {@link StatusCode#MESSAGE_TOO_LARGE}
+ *
* Binary Message Versions
*
- * WebSocket Frames over this maximum will result in a close code 1009 {@link StatusCode#MESSAGE_TOO_LARGE}
- *
+ * Installing Autobahn:
+ *
+ * Upgrading an existing installation of autobahntestsuite
+ *
+ * Running Autobahn Fuzzing Server (which you run this client implementation against):
+ *
+ * Installing Autobahn:
+ *
+ * Upgrading an existing installation of autobahntestsuite
+ *
+ * Running Autobahn Fuzzing Client (against this server implementation):
+ *
+ * # For Debian / Ubuntu
+ * $ sudo apt-get install python python-dev python-twisted
+ * $ sudo apt-get install python-pip
+ * $ sudo pip install autobahntestsuite
+ *
+ * # For Fedora / Redhat
+ * $ sudo yum install python python-dev python-pip twisted
+ * $ sudo yum install libffi-devel
+ * $ sudo pip install autobahntestsuite
+ *
+ *
+ * $ sudo pip install -U autobahntestsuite
+ *
+ *
+ * # Change to javax-websocket-tests directory first.
+ * $ cd jetty-websocket/javax-websocket-tests/
+ * $ wstest --mode=fuzzingserver --spec=fuzzingserver.json
+ *
+ * # Report output is configured (in the fuzzingserver.json) at location:
+ * $ ls target/reports/clients/
+ *
+ */
+public class JavaxAutobahnClient
+{
+ public static void main(String[] args)
+ {
+ String hostname = "localhost";
+ int port = 9001;
+
+ if (args.length > 0)
+ hostname = args[0];
+ if (args.length > 1)
+ port = Integer.parseInt(args[1]);
+
+ // Optional case numbers
+ // NOTE: these are url query parameter case numbers (whole integers, eg "6"), not the case ids (eg "7.3.1")
+ int[] caseNumbers = null;
+ if (args.length > 2)
+ {
+ int offset = 2;
+ caseNumbers = new int[args.length - offset];
+ for (int i = offset; i < args.length; i++)
+ {
+ caseNumbers[i - offset] = Integer.parseInt(args[i]);
+ }
+ }
+
+ JavaxAutobahnClient client = null;
+ try
+ {
+ String userAgent = "JettyWebsocketClient/" + Jetty.VERSION;
+ client = new JavaxAutobahnClient(hostname, port, userAgent);
+
+ LOG.info("Running test suite...");
+ LOG.info("Using Fuzzing Server: {}:{}", hostname, port);
+ LOG.info("User Agent: {}", userAgent);
+
+ if (caseNumbers == null)
+ {
+ int caseCount = client.getCaseCount();
+ LOG.info("Will run all {} cases ...", caseCount);
+ for (int caseNum = 1; caseNum <= caseCount; caseNum++)
+ {
+ LOG.info("Running case {} (of {}) ...", caseNum, caseCount);
+ client.runCaseByNumber(caseNum);
+ }
+ }
+ else
+ {
+ LOG.info("Will run %d cases ...", caseNumbers.length);
+ for (int caseNum : caseNumbers)
+ {
+ client.runCaseByNumber(caseNum);
+ }
+ }
+ LOG.info("All test cases executed.");
+ client.updateReports();
+ }
+ catch (Throwable t)
+ {
+ LOG.warn("Test Failed", t);
+ }
+ finally
+ {
+ if (client != null)
+ client.stop();
+ }
+ }
+
+ private static final Logger LOG = Log.getLogger(JavaxAutobahnClient.class);
+ private URI baseWebsocketUri;
+ private JavaxWebSocketClientContainer clientContainer;
+ private String userAgent;
+
+ public JavaxAutobahnClient(String hostname, int port, String userAgent) throws Exception
+ {
+ this.userAgent = userAgent;
+ this.baseWebsocketUri = new URI("ws://" + hostname + ":" + port);
+ this.clientContainer = new JavaxWebSocketClientContainer();
+ clientContainer.start();
+ }
+
+ public void stop()
+ {
+ LifeCycle.stop(clientContainer);
+ }
+
+ public int getCaseCount()
+ {
+ URI wsUri = baseWebsocketUri.resolve("/getCaseCount");
+ EventSocket onCaseCount = new EventSocket();
+
+ try
+ {
+ clientContainer.connectToServer(onCaseCount, wsUri);
+ String msg = onCaseCount.messageQueue.poll(10, TimeUnit.SECONDS);
+ onCaseCount.session.close(new CloseReason(CloseReason.CloseCodes.GOING_AWAY, null));
+ assertTrue(onCaseCount.closeLatch.await(2, TimeUnit.SECONDS));
+ assertNotNull(msg);
+ return Integer.decode(msg);
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalStateException("Unable to get Case Count", t);
+ }
+ }
+
+ public void runCaseByNumber(int caseNumber) throws Exception
+ {
+ URI wsUri = baseWebsocketUri.resolve("/runCase?case=" + caseNumber + "&agent=" + UrlEncoded.encodeString(userAgent));
+ LOG.info("test uri: {}", wsUri);
+
+ JavaxAutobahnSocket echoHandler = new JavaxAutobahnSocket();
+ clientContainer.connectToServer(echoHandler, wsUri);
+
+ // Wait up to 5 min as some of the tests can take a while
+ if (!echoHandler.closeLatch.await(5, TimeUnit.MINUTES))
+ {
+ LOG.warn("could not close {}, closing session", echoHandler);
+ echoHandler.session.close(new CloseReason(CloseReason.CloseCodes.GOING_AWAY, null));
+ }
+ }
+
+ public void updateReports() throws Exception
+ {
+ URI wsUri = baseWebsocketUri.resolve("/updateReports?agent=" + UrlEncoded.encodeString(userAgent));
+ EventSocket onUpdateReports = new EventSocket();
+ clientContainer.connectToServer(onUpdateReports, wsUri);
+ assertTrue(onUpdateReports.closeLatch.await(15, TimeUnit.SECONDS));
+ LOG.info("Reports updated.");
+ LOG.info("Test suite finished!");
+ }
+}
diff --git a/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/autobahn/JavaxAutobahnServer.java b/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/autobahn/JavaxAutobahnServer.java
new file mode 100644
index 00000000000..543d6812794
--- /dev/null
+++ b/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/autobahn/JavaxAutobahnServer.java
@@ -0,0 +1,82 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2019 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.javax.tests.autobahn;
+
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.websocket.javax.server.config.JavaxWebSocketServletContainerInitializer;
+
+/**
+ * WebSocket Server for use with autobahn websocket testsuite (wstest).
+ *
+ * # For Debian / Ubuntu
+ * $ sudo apt-get install python python-dev python-twisted
+ * $ sudo apt-get install python-pip
+ * $ sudo pip install autobahntestsuite
+ *
+ * # For Fedora / Redhat
+ * $ sudo yum install python python-dev python-pip twisted
+ * $ sudo yum install libffi-devel
+ * $ sudo pip install autobahntestsuite
+ *
+ *
+ * $ sudo pip install -U autobahntestsuite
+ *
+ *
+ * # Change to javax-websocket-tests directory first.
+ * $ cd jetty-websocket/javax-websocket-tests/
+ * $ wstest --mode=fuzzingclient --spec=fuzzingclient.json
+ *
+ * # Report output is configured (in the fuzzingclient.json) at location:
+ * $ ls target/reports/servers/
+ *
+ */
+public class JavaxAutobahnServer
+{
+ public static void main(String[] args) throws Exception
+ {
+ int port = 9001; // same port as found in fuzzing-client.json
+ if (args != null && args.length > 0)
+ port = Integer.parseInt(args[0]);
+
+ Server server = new Server(port);
+ ServerConnector connector = new ServerConnector(server);
+ connector.setIdleTimeout(10000);
+ server.addConnector(connector);
+ ServletContextHandler context = new ServletContextHandler();
+ context.setContextPath("/");
+ server.setHandler(context);
+
+ JavaxWebSocketServletContainerInitializer.configure(context, (servletContext, container)->
+ container.addEndpoint(JavaxAutobahnSocket.class));
+
+ server.start();
+ server.join();
+ }
+}
diff --git a/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/autobahn/JavaxAutobahnSocket.java b/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/autobahn/JavaxAutobahnSocket.java
new file mode 100644
index 00000000000..be746df58b3
--- /dev/null
+++ b/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/autobahn/JavaxAutobahnSocket.java
@@ -0,0 +1,76 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2019 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.javax.tests.autobahn;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.concurrent.CountDownLatch;
+import javax.websocket.ClientEndpoint;
+import javax.websocket.OnClose;
+import javax.websocket.OnError;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.server.ServerEndpoint;
+
+import org.eclipse.jetty.util.log.Log;
+import org.eclipse.jetty.util.log.Logger;
+
+@ClientEndpoint
+@ServerEndpoint("/")
+public class JavaxAutobahnSocket
+{
+ private static final Logger LOG = Log.getLogger(JavaxAutobahnSocket.class);
+
+ public Session session;
+ public CountDownLatch closeLatch = new CountDownLatch(1);
+
+ @OnOpen
+ public void onConnect(Session session)
+ {
+ this.session = session;
+ session.setMaxTextMessageBufferSize(Integer.MAX_VALUE);
+ session.setMaxBinaryMessageBufferSize(Integer.MAX_VALUE);
+ }
+
+ @OnMessage
+ public void onText(String message) throws IOException
+ {
+ session.getBasicRemote().sendText(message);
+ }
+
+ @OnMessage
+ public void onBinary(ByteBuffer message) throws IOException
+ {
+ session.getBasicRemote().sendBinary(message);
+ }
+
+ @OnError
+ public void onError(Throwable t)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.debug("onError()", t);
+ }
+
+ @OnClose
+ public void onClose()
+ {
+ closeLatch.countDown();
+ }
+}
diff --git a/jetty-websocket/jetty-websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java b/jetty-websocket/jetty-websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java
index 8b089fdbcba..f043b864cb6 100644
--- a/jetty-websocket/jetty-websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java
+++ b/jetty-websocket/jetty-websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java
@@ -84,6 +84,20 @@ public interface WebSocketPolicy
*/
long getMaxTextMessageSize();
+ /**
+ * The maximum payload size of any WebSocket Frame which can be received.
+ *
+ * @return the maximum size of a WebSocket Frame.
+ */
+ long getMaxFrameSize();
+
+ /**
+ * If true, frames are automatically fragmented to respect the maximum frame size.
+ *
+ * @return whether to automatically fragment incoming WebSocket Frames.
+ */
+ boolean isAutoFragment();
+
/**
* The duration that a websocket may be idle before being closed by the implementation
*
@@ -123,4 +137,21 @@ public interface WebSocketPolicy
* @param size the maximum allowed size of a text message.
*/
void setMaxTextMessageSize(long size);
+
+ /**
+ * The maximum payload size of any WebSocket Frame which can be received.
+ *
+ *
public void methodName({@link Session} session, ByteBuffer message)
public void methodName({@link Session} session, byte buf[], int offset, int length)
+ * # For Debian / Ubuntu
+ * $ sudo apt-get install python python-dev python-twisted
+ * $ sudo apt-get install python-pip
+ * $ sudo pip install autobahntestsuite
+ *
+ * # For Fedora / Redhat
+ * $ sudo yum install python python-dev python-pip twisted
+ * $ sudo yum install libffi-devel
+ * $ sudo pip install autobahntestsuite
+ *
+ *
+ * $ sudo pip install -U autobahntestsuite
+ *
+ *
+ * # Change to jetty-websocket-tests directory first.
+ * $ cd jetty-websocket/jetty-websocket-tests/
+ * $ wstest --mode=fuzzingserver --spec=fuzzingserver.json
+ *
+ * # Report output is configured (in the fuzzingserver.json) at location:
+ * $ ls target/reports/clients/
+ *
+ */
+public class JettyAutobahnClient
+{
+ public static void main(String[] args)
+ {
+ String hostname = "localhost";
+ int port = 9001;
+
+ if (args.length > 0)
+ hostname = args[0];
+ if (args.length > 1)
+ port = Integer.parseInt(args[1]);
+
+ // Optional case numbers
+ // NOTE: these are url query parameter case numbers (whole integers, eg "6"), not the case ids (eg "7.3.1")
+ int[] caseNumbers = null;
+ if (args.length > 2)
+ {
+ int offset = 2;
+ caseNumbers = new int[args.length - offset];
+ for (int i = offset; i < args.length; i++)
+ {
+ caseNumbers[i - offset] = Integer.parseInt(args[i]);
+ }
+ }
+
+ JettyAutobahnClient client = null;
+ try
+ {
+ String userAgent = "JettyWebsocketClient/" + Jetty.VERSION;
+ client = new JettyAutobahnClient(hostname, port, userAgent);
+
+ LOG.info("Running test suite...");
+ LOG.info("Using Fuzzing Server: {}:{}", hostname, port);
+ LOG.info("User Agent: {}", userAgent);
+
+ if (caseNumbers == null)
+ {
+ int caseCount = client.getCaseCount();
+ LOG.info("Will run all {} cases ...", caseCount);
+ for (int caseNum = 1; caseNum <= caseCount; caseNum++)
+ {
+ LOG.info("Running case {} (of {}) ...", caseNum, caseCount);
+ client.runCaseByNumber(caseNum);
+ }
+ }
+ else
+ {
+ LOG.info("Will run %d cases ...", caseNumbers.length);
+ for (int caseNum : caseNumbers)
+ {
+ client.runCaseByNumber(caseNum);
+ }
+ }
+ LOG.info("All test cases executed.");
+ client.updateReports();
+ }
+ catch (Throwable t)
+ {
+ LOG.warn("Test Failed", t);
+ }
+ finally
+ {
+ if (client != null)
+ client.shutdown();
+ }
+ }
+
+ private static final Logger LOG = Log.getLogger(JettyAutobahnClient.class);
+ private URI baseWebsocketUri;
+ private WebSocketClient client;
+ private String userAgent;
+
+ public JettyAutobahnClient(String hostname, int port, String userAgent) throws Exception
+ {
+ this.userAgent = userAgent;
+ this.baseWebsocketUri = new URI("ws://" + hostname + ":" + port);
+ this.client = new WebSocketClient();
+ this.client.start();
+ }
+
+ public int getCaseCount() throws IOException, InterruptedException
+ {
+ URI wsUri = baseWebsocketUri.resolve("/getCaseCount");
+ EventSocket onCaseCount = new EventSocket();
+ CompletableFuture
+ * # For Debian / Ubuntu
+ * $ sudo apt-get install python python-dev python-twisted
+ * $ sudo apt-get install python-pip
+ * $ sudo pip install autobahntestsuite
+ *
+ * # For Fedora / Redhat
+ * $ sudo yum install python python-dev python-pip twisted
+ * $ sudo yum install libffi-devel
+ * $ sudo pip install autobahntestsuite
+ *
+ *
+ * $ sudo pip install -U autobahntestsuite
+ *
+ *
+ * # Change to jetty-websocket-tests directory first.
+ * $ cd jetty-websocket/jetty-websocket-tests/
+ * $ wstest --mode=fuzzingclient --spec=fuzzingclient.json
+ *
+ * # Report output is configured (in the fuzzingclient.json) at location:
+ * $ ls target/reports/servers/
+ *
+ */
+public class JettyAutobahnServer
+{
+ public static void main(String[] args) throws Exception
+ {
+ int port = 9001; // same port as found in fuzzing-client.json
+ if (args != null && args.length > 0)
+ port = Integer.parseInt(args[0]);
+
+ Server server = new Server(port);
+ ServerConnector connector = new ServerConnector(server);
+ connector.setIdleTimeout(10000);
+ server.addConnector(connector);
+ ServletContextHandler context = new ServletContextHandler();
+ context.setContextPath("/");
+ server.setHandler(context);
+
+ JettyWebSocketServletContainerInitializer.configure(context, (servletContext, container)->
+ container.addMapping("/", (req, resp) -> new JettyAutobahnSocket()));
+
+ server.start();
+ server.join();
+ }
+}
diff --git a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/autobahn/JettyAutobahnSocket.java b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/autobahn/JettyAutobahnSocket.java
new file mode 100644
index 00000000000..d1d99cf659a
--- /dev/null
+++ b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/autobahn/JettyAutobahnSocket.java
@@ -0,0 +1,37 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2019 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.tests.autobahn;
+
+import org.eclipse.jetty.websocket.api.Session;
+import org.eclipse.jetty.websocket.api.annotations.WebSocket;
+import org.eclipse.jetty.websocket.core.WebSocketConstants;
+import org.eclipse.jetty.websocket.tests.EchoSocket;
+
+@WebSocket
+public class JettyAutobahnSocket extends EchoSocket
+{
+ @Override
+ public void onOpen(Session session)
+ {
+ super.onOpen(session);
+ session.setMaxTextMessageSize(Long.MAX_VALUE);
+ session.setMaxBinaryMessageSize(Long.MAX_VALUE);
+ session.setMaxFrameSize(WebSocketConstants.DEFAULT_MAX_FRAME_SIZE*2);
+ }
+}
diff --git a/jetty-websocket/websocket-core/pom.xml b/jetty-websocket/websocket-core/pom.xml
index 1e3067f593b..60879dcaa46 100644
--- a/jetty-websocket/websocket-core/pom.xml
+++ b/jetty-websocket/websocket-core/pom.xml
@@ -141,7 +141,7 @@
- * # Change to websocket-core + * # Change to websocket-core first * $ cd jetty-websocket/websocket-core * $ wstest --mode=fuzzingserver --spec=fuzzingserver.json * @@ -70,7 +70,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; * $ ls target/reports/clients/ **/ -public class AutobahnWebSocketClient +public class CoreAutobahnClient { public static void main(String[] args) { @@ -95,11 +95,11 @@ public class AutobahnWebSocketClient } } - AutobahnWebSocketClient client = null; + CoreAutobahnClient client = null; try { String userAgent = "JettyWebsocketClient/" + Jetty.VERSION; - client = new AutobahnWebSocketClient(hostname, port, userAgent); + client = new CoreAutobahnClient(hostname, port, userAgent); LOG.info("Running test suite..."); LOG.info("Using Fuzzing Server: {}:{}", hostname, port); @@ -137,12 +137,12 @@ public class AutobahnWebSocketClient } } - private static final Logger LOG = Log.getLogger(AutobahnWebSocketClient.class); + private static final Logger LOG = Log.getLogger(CoreAutobahnClient.class); private URI baseWebsocketUri; private WebSocketCoreClient client; private String userAgent; - public AutobahnWebSocketClient(String hostname, int port, String userAgent) throws Exception + public CoreAutobahnClient(String hostname, int port, String userAgent) throws Exception { this.userAgent = userAgent; this.baseWebsocketUri = new URI("ws://" + hostname + ":" + port); diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnWebSocketServer.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnServer.java similarity index 98% rename from jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnWebSocketServer.java rename to jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnServer.java index 9f1978534d1..93ba4f58346 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnWebSocketServer.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnServer.java @@ -57,7 +57,7 @@ import org.eclipse.jetty.websocket.core.server.WebSocketUpgradeHandler; * $ ls target/reports/servers/ * */ -public class AutobahnWebSocketServer +public class CoreAutobahnServer { public static void main(String[] args) throws Exception { diff --git a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/ServletUpgradeResponse.java b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/ServletUpgradeResponse.java index 15ac69ba78e..af915587669 100644 --- a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/ServletUpgradeResponse.java +++ b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/ServletUpgradeResponse.java @@ -176,7 +176,7 @@ public class ServletUpgradeResponse if (matches < 1) throw new IllegalArgumentException("Extension not a requested extension"); - matches = negotiation.getNegotiatedExtensions().stream().filter(e -> e.getName().equals(config.getName())).count(); + matches = configs.stream().filter(e -> e.getName().equals(config.getName())).count(); if (matches > 1) throw new IllegalArgumentException("Multiple extensions of the same name"); }