fix websocket tests from merge

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2020-07-23 12:17:20 +10:00
parent cd3f495e9c
commit d5cf429537
2 changed files with 4 additions and 3 deletions

View File

@ -33,6 +33,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.BufferUtil;
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.core.CloseStatus;
import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.Frame;
import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.OpCode;
import org.eclipse.jetty.websocket.core.internal.Generator; import org.eclipse.jetty.websocket.core.internal.Generator;
@ -150,7 +151,7 @@ public class WebSocketStatsTest
assertThat(statistics.getReceivedMessages(), is(numMessages + 2L)); assertThat(statistics.getReceivedMessages(), is(numMessages + 2L));
Frame textFrame = new Frame(OpCode.TEXT, msgText); Frame textFrame = new Frame(OpCode.TEXT, msgText);
Frame closeFrame = new Frame(OpCode.CLOSE); Frame closeFrame = CloseStatus.NORMAL_STATUS.toFrame();
final long textFrameSize = getFrameByteSize(textFrame); final long textFrameSize = getFrameByteSize(textFrame);
final long closeFrameSize = getFrameByteSize(closeFrame); final long closeFrameSize = getFrameByteSize(closeFrame);

View File

@ -467,7 +467,7 @@ public class DistributionTests extends AbstractDistributionTest
assertThat(webSocketListener.textMessages.poll(5, TimeUnit.SECONDS), is("echo message")); assertThat(webSocketListener.textMessages.poll(5, TimeUnit.SECONDS), is("echo message"));
session.close(); session.close();
assertTrue(webSocketListener.closeLatch.await(5, TimeUnit.SECONDS)); assertTrue(webSocketListener.closeLatch.await(5, TimeUnit.SECONDS));
assertThat(webSocketListener.closeCode, is(StatusCode.NO_CODE)); assertThat(webSocketListener.closeCode, is(StatusCode.NORMAL));
// Verify that /test2 and /test3 could not be started. // Verify that /test2 and /test3 could not be started.
ContentResponse response = client.GET(serverUri.resolve("/test2/badonopen/a")); ContentResponse response = client.GET(serverUri.resolve("/test2/badonopen/a"));
@ -482,7 +482,7 @@ public class DistributionTests extends AbstractDistributionTest
assertThat(webSocketListener.textMessages.poll(5, TimeUnit.SECONDS), is("echo message")); assertThat(webSocketListener.textMessages.poll(5, TimeUnit.SECONDS), is("echo message"));
session.close(); session.close();
assertTrue(webSocketListener.closeLatch.await(5, TimeUnit.SECONDS)); assertTrue(webSocketListener.closeLatch.await(5, TimeUnit.SECONDS));
assertThat(webSocketListener.closeCode, is(StatusCode.NO_CODE)); assertThat(webSocketListener.closeCode, is(StatusCode.NORMAL));
} }
} }
} }