-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding both WebSocket tests to /test-integration/ to verify behavior
that is causing problems from within OSGi. + Renamed TestableJettyServer to XmlBasedJettyServer to avoid it being picked up as a Test class (due it starting with the name "Test") + Renamed .addConfiguration() to .addXmlConfiguration() to reflect true nature, and also to avoid naming confusion with new Configuration infrastructure in Jetty. Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
- Loading branch information
Showing
16 changed files
with
583 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...est-integration/src/test/java/org/eclipse/jetty/test/websocket/JavaxSimpleEchoSocket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// | ||
// ======================================================================== | ||
// 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.test.websocket; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import java.util.concurrent.CountDownLatch; | ||
|
||
import javax.websocket.ClientEndpoint; | ||
import javax.websocket.CloseReason; | ||
import javax.websocket.OnClose; | ||
import javax.websocket.OnError; | ||
import javax.websocket.OnMessage; | ||
import javax.websocket.OnOpen; | ||
import javax.websocket.Session; | ||
|
||
import org.eclipse.jetty.util.log.Log; | ||
import org.eclipse.jetty.util.log.Logger; | ||
|
||
@ClientEndpoint( | ||
subprotocols = {"chat"}) | ||
public class JavaxSimpleEchoSocket | ||
{ | ||
private static final Logger LOG = Log.getLogger(JavaxSimpleEchoSocket.class); | ||
private Session session; | ||
public CountDownLatch messageLatch = new CountDownLatch(1); | ||
public CountDownLatch closeLatch = new CountDownLatch(1); | ||
|
||
@OnError | ||
public void onError(Throwable t) | ||
{ | ||
LOG.warn(t); | ||
fail(t.getMessage()); | ||
} | ||
|
||
@OnClose | ||
public void onClose(CloseReason close) | ||
{ | ||
LOG.debug("Closed: {}, {}", close.getCloseCode().getCode(), close.getReasonPhrase()); | ||
closeLatch.countDown(); | ||
} | ||
|
||
@OnMessage | ||
public void onMessage(String message) | ||
{ | ||
LOG.debug("Received: {}", message); | ||
messageLatch.countDown(); | ||
} | ||
|
||
@OnOpen | ||
public void onOpen(Session session) | ||
{ | ||
LOG.debug("Opened"); | ||
this.session = session; | ||
} | ||
} |
Oops, something went wrong.