mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
Add write_frames unit test
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
* Require Visual Studio 2015 Update 3 or later
|
||||
* Use fwrite return value in file_body
|
||||
* Add decorator unit test
|
||||
* Add write_frames unit test
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@ -805,6 +805,32 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
https://github.com/vinniefalco/Beast/issues/300
|
||||
|
||||
Write a message as two individual frames
|
||||
*/
|
||||
void
|
||||
testWriteFrames(endpoint_type const& ep)
|
||||
{
|
||||
error_code ec;
|
||||
socket_type sock{ios_};
|
||||
sock.connect(ep, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
stream<socket_type&> ws{sock};
|
||||
ws.handshake("localhost", "/", ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
ws.write_frame(false, sbuf("u"));
|
||||
ws.write_frame(true, sbuf("v"));
|
||||
streambuf sb;
|
||||
opcode op;
|
||||
ws.read(op, sb, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
testAsyncWriteFrame(endpoint_type const& ep)
|
||||
{
|
||||
@ -1281,9 +1307,14 @@ public:
|
||||
testBadHandshakes();
|
||||
testBadResponses();
|
||||
|
||||
permessage_deflate pmd;
|
||||
pmd.client_enable = false;
|
||||
pmd.server_enable = false;
|
||||
|
||||
{
|
||||
error_code ec;
|
||||
::websocket::sync_echo_server server{nullptr};
|
||||
server.set_option(pmd);
|
||||
server.open(any, ec);
|
||||
BEAST_EXPECTS(! ec, ec.message());
|
||||
auto const ep = server.local_endpoint();
|
||||
@ -1293,6 +1324,7 @@ public:
|
||||
testInvokable3(ep);
|
||||
testInvokable4(ep);
|
||||
//testInvokable5(ep);
|
||||
testWriteFrames(ep);
|
||||
testAsyncWriteFrame(ep);
|
||||
}
|
||||
|
||||
@ -1340,8 +1372,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
permessage_deflate pmd;
|
||||
|
||||
pmd.client_enable = false;
|
||||
pmd.server_enable = false;
|
||||
doClientTests(pmd);
|
||||
|
Reference in New Issue
Block a user