WebSocket test fix
This commit is contained in:
parent
a1d65325fc
commit
8dbe1798bd
|
@ -28,17 +28,14 @@ import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.websocket.OnMessage;
|
import javax.websocket.OnMessage;
|
||||||
import javax.websocket.OnOpen;
|
|
||||||
import javax.websocket.server.ServerEndpoint;
|
import javax.websocket.server.ServerEndpoint;
|
||||||
|
|
||||||
import org.eclipse.jetty.toolchain.test.TestingDir;
|
import org.eclipse.jetty.toolchain.test.TestingDir;
|
||||||
import org.eclipse.jetty.webapp.WebAppContext;
|
import org.eclipse.jetty.webapp.WebAppContext;
|
||||||
import org.eclipse.jetty.websocket.api.Session;
|
import org.eclipse.jetty.websocket.api.Session;
|
||||||
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
||||||
import org.eclipse.jetty.websocket.tests.LeakTrackingBufferPoolRule;
|
|
||||||
import org.eclipse.jetty.websocket.tests.TrackingEndpoint;
|
import org.eclipse.jetty.websocket.tests.TrackingEndpoint;
|
||||||
import org.eclipse.jetty.websocket.tests.WSServer;
|
import org.eclipse.jetty.websocket.tests.WSServer;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -51,32 +48,17 @@ public class LargeAnnotatedTest
|
||||||
@ServerEndpoint(value = "/echo/large")
|
@ServerEndpoint(value = "/echo/large")
|
||||||
public static class LargeEchoConfiguredSocket
|
public static class LargeEchoConfiguredSocket
|
||||||
{
|
{
|
||||||
private javax.websocket.Session session;
|
@OnMessage(maxMessageSize = 128 * 1024)
|
||||||
|
public String echo(String msg)
|
||||||
@OnOpen
|
|
||||||
public void open(javax.websocket.Session session)
|
|
||||||
{
|
{
|
||||||
this.session = session;
|
return msg;
|
||||||
this.session.setMaxTextMessageBufferSize(128 * 1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
@OnMessage
|
|
||||||
public void echo(String msg)
|
|
||||||
{
|
|
||||||
// reply with echo
|
|
||||||
session.getAsyncRemote().sendText(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public TestingDir testdir = new TestingDir();
|
public TestingDir testdir = new TestingDir();
|
||||||
|
|
||||||
@Rule
|
|
||||||
public LeakTrackingBufferPoolRule bufferPool = new LeakTrackingBufferPoolRule("Test");
|
|
||||||
|
|
||||||
@SuppressWarnings("Duplicates")
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore("Not working yet")
|
|
||||||
public void testEcho() throws Exception
|
public void testEcho() throws Exception
|
||||||
{
|
{
|
||||||
WSServer wsb = new WSServer(testdir,"app");
|
WSServer wsb = new WSServer(testdir,"app");
|
||||||
|
@ -90,9 +72,8 @@ public class LargeAnnotatedTest
|
||||||
|
|
||||||
WebAppContext webapp = wsb.createWebAppContext();
|
WebAppContext webapp = wsb.createWebAppContext();
|
||||||
wsb.deployWebapp(webapp);
|
wsb.deployWebapp(webapp);
|
||||||
// wsb.dump();
|
|
||||||
|
|
||||||
WebSocketClient client = new WebSocketClient(bufferPool);
|
WebSocketClient client = new WebSocketClient();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
client.getPolicy().setMaxTextMessageSize(128*1024);
|
client.getPolicy().setMaxTextMessageSize(128*1024);
|
||||||
|
|
Loading…
Reference in New Issue