diff options
author | Loïc Hoguin <[email protected]> | 2011-12-22 20:19:05 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2011-12-22 20:19:05 +0100 |
commit | 7a68a38e5a0bc5bea4b542aebf123d8c3496dee0 (patch) | |
tree | 50d55a14db3f9f0fe99a32385dad181d149ae3a8 /test/ws_SUITE.erl | |
parent | 9800348c2138ec1f7fa140b61127b3cc3d346f1d (diff) | |
download | cowboy-7a68a38e5a0bc5bea4b542aebf123d8c3496dee0.tar.gz cowboy-7a68a38e5a0bc5bea4b542aebf123d8c3496dee0.tar.bz2 cowboy-7a68a38e5a0bc5bea4b542aebf123d8c3496dee0.zip |
Add ct tests for binary websocket frames
Diffstat (limited to 'test/ws_SUITE.erl')
-rw-r--r-- | test/ws_SUITE.erl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl index ccb57b5..136833f 100644 --- a/test/ws_SUITE.erl +++ b/test/ws_SUITE.erl @@ -281,10 +281,20 @@ ws13(Config) -> {'Upgrade', "websocket"} = lists:keyfind('Upgrade', 1, Headers), {"sec-websocket-accept", "s3pPLMBiTxaQ9kYGzzhZRbK+xOo="} = lists:keyfind("sec-websocket-accept", 1, Headers), + %% text ok = gen_tcp:send(Socket, << 16#81, 16#85, 16#37, 16#fa, 16#21, 16#3d, 16#7f, 16#9f, 16#4d, 16#51, 16#58 >>), {ok, << 1:1, 0:3, 1:4, 0:1, 5:7, "Hello" >>} = gen_tcp:recv(Socket, 0, 6000), + %% binary (empty) + ok = gen_tcp:send(Socket, << 1:1, 0:3, 2:4, 0:8 >>), + {ok, << 1:1, 0:3, 2:4, 0:8 >>} = gen_tcp:recv(Socket, 0, 6000), + %% binary + ok = gen_tcp:send(Socket, << 16#82, 16#85, 16#37, 16#fa, 16#21, 16#3d, + 16#7f, 16#9f, 16#4d, 16#51, 16#58 >>), + {ok, << 1:1, 0:3, 2:4, 0:1, 5:7, "Hello" >>} + = gen_tcp:recv(Socket, 0, 6000), + %% Receives. {ok, << 1:1, 0:3, 1:4, 0:1, 14:7, "websocket_init" >>} = gen_tcp:recv(Socket, 0, 6000), {ok, << 1:1, 0:3, 1:4, 0:1, 16:7, "websocket_handle" >>} |