use of io.undertow.websockets.utils.WebSocketTestClient in project undertow by undertow-io.
the class AnnotatedEndpointTest method testEncodingAndDecodingText.
@Test
public void testEncodingAndDecodingText() throws Exception {
final byte[] payload = "hello".getBytes();
final FutureResult<?> latch = new FutureResult<>();
WebSocketTestClient client = new WebSocketTestClient(WebSocketVersion.V13, new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/ws/encoding/Stuart"));
client.connect();
client.send(new TextWebSocketFrame(Unpooled.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, "hello Stuart".getBytes(), latch));
latch.getIoFuture().get();
client.destroy();
}
use of io.undertow.websockets.utils.WebSocketTestClient in project undertow by undertow-io.
the class AnnotatedEndpointTest method testStringOnMessageAddedProgramatically.
@Test
public void testStringOnMessageAddedProgramatically() throws Exception {
final byte[] payload = "foo".getBytes();
final FutureResult<?> latch = new FutureResult<>();
WebSocketTestClient client = new WebSocketTestClient(WebSocketVersion.V13, new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/ws/programmatic"));
client.connect();
client.send(new TextWebSocketFrame(Unpooled.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, "oof".getBytes(), latch));
latch.getIoFuture().get();
client.destroy();
}
use of io.undertow.websockets.utils.WebSocketTestClient in project undertow by undertow-io.
the class AnnotatedEndpointTest method testEncodingWithGenericSuperclass.
@Test
public void testEncodingWithGenericSuperclass() throws Exception {
final byte[] payload = "hello".getBytes();
final FutureResult<?> latch = new FutureResult<>();
WebSocketTestClient client = new WebSocketTestClient(WebSocketVersion.V13, new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/ws/encodingGenerics/Stuart"));
client.connect();
client.send(new TextWebSocketFrame(Unpooled.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, "hello Stuart".getBytes(), latch));
latch.getIoFuture().get();
client.destroy();
}
use of io.undertow.websockets.utils.WebSocketTestClient in project undertow by undertow-io.
the class AnnotatedEndpointTest method testStringOnMessage.
@Test
public void testStringOnMessage() throws Exception {
final byte[] payload = "hello".getBytes();
final FutureResult<?> latch = new FutureResult<>();
WebSocketTestClient client = new WebSocketTestClient(WebSocketVersion.V13, new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/ws/chat/Stuart"));
client.connect();
client.send(new TextWebSocketFrame(Unpooled.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, "hello Stuart".getBytes(), latch));
latch.getIoFuture().get();
client.destroy();
}
use of io.undertow.websockets.utils.WebSocketTestClient in project undertow by undertow-io.
the class AnnotatedEndpointTest method testEncodingAndDecodingBinary.
@Test
public void testEncodingAndDecodingBinary() throws Exception {
final byte[] payload = "hello".getBytes();
final FutureResult<?> latch = new FutureResult<>();
WebSocketTestClient client = new WebSocketTestClient(WebSocketVersion.V13, new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/ws/encoding/Stuart"));
client.connect();
client.send(new BinaryWebSocketFrame(Unpooled.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, "hello Stuart".getBytes(), latch));
latch.getIoFuture().get();
client.destroy();
}
Aggregations