static
void
fail_loop(
- std::function<void(stream<test::stream>&)> f,
+ std::function<void(
+ stream<test::basic_stream<net::io_context::executor_type>>&)>
+ f,
std::chrono::steady_clock::duration amount =
std::chrono::seconds(5))
{
test::fail_count fc(n);
try
{
- stream<test::stream> ws(ioc, fc);
+ stream<test::basic_stream<net::io_context::executor_type>>
+ ws(ioc, fc);
auto tr = connect(ws.next_layer());
f(ws);
break;
net::io_context ioc;
// request in stream
- fail_loop([&](stream<test::stream>& ws)
+ fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws)
{
ws.next_layer().append(
"GET / HTTP/1.1\r\n"
});
// request in stream, decorator
- fail_loop([&](stream<test::stream>& ws)
+ fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws)
{
ws.next_layer().append(
"GET / HTTP/1.1\r\n"
});
// request in buffers
- fail_loop([&](stream<test::stream>& ws)
+ fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws)
{
api.accept(ws, sbuf(
"GET / HTTP/1.1\r\n"
});
// request in buffers, decorator
- fail_loop([&](stream<test::stream>& ws)
+ fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws)
{
bool called = false;
ws.set_option(stream_base::decorator(
});
// request in buffers and stream
- fail_loop([&](stream<test::stream>& ws)
+ fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws)
{
ws.next_layer().append(
"Connection: upgrade\r\n"
});
// request in buffers and stream, decorator
- fail_loop([&](stream<test::stream>& ws)
+ fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws)
{
ws.next_layer().append(
"Connection: upgrade\r\n"
req.insert(http::field::sec_websocket_key, "dGhlIHNhbXBsZSBub25jZQ==");
req.insert(http::field::sec_websocket_version, "13");
- fail_loop([&](stream<test::stream>& ws)
+ fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws)
{
api.accept(ws, req);
});
req.insert(http::field::sec_websocket_key, "dGhlIHNhbXBsZSBub25jZQ==");
req.insert(http::field::sec_websocket_version, "13");
- fail_loop([&](stream<test::stream>& ws)
+ fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws)
{
bool called = false;
ws.set_option(stream_base::decorator(
req.insert(http::field::sec_websocket_key, "dGhlIHNhbXBsZSBub25jZQ==");
req.insert(http::field::sec_websocket_version, "13");
- fail_loop([&](stream<test::stream>& ws)
+ fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws)
{
ws.next_layer().append("\x88\x82\xff\xff\xff\xff\xfc\x17");
api.accept(ws, req);
}
// failed handshake (missing Sec-WebSocket-Key)
- fail_loop([&](stream<test::stream>& ws)
+ fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws)
{
ws.next_layer().append(
"GET / HTTP/1.1\r\n"
// request in stream
{
- stream<test::stream> ws{ioc,
+ stream<test::basic_stream<net::io_context::executor_type>> ws{ioc,
"GET / HTTP/1.1\r\n"
"Host: localhost\r\n"
"Upgrade: websocket\r\n"
// request in stream, decorator
{
- stream<test::stream> ws{ioc,
+ stream<test::basic_stream<net::io_context::executor_type>> ws{ioc,
"GET / HTTP/1.1\r\n"
"Host: localhost\r\n"
"Upgrade: websocket\r\n"
// request in buffers
{
- stream<test::stream> ws{ioc};
+ stream<test::basic_stream<net::io_context::executor_type>> ws{ioc};
auto tr = connect(ws.next_layer());
try
{
// request in buffers, decorator
{
- stream<test::stream> ws{ioc};
+ stream<test::basic_stream<net::io_context::executor_type>> ws{ioc};
auto tr = connect(ws.next_layer());
try
{
// request in buffers and stream
{
- stream<test::stream> ws{ioc,
+ stream<test::basic_stream<net::io_context::executor_type>> ws{ioc,
"Connection: upgrade\r\n"
"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n"
"Sec-WebSocket-Version: 13\r\n"
// request in buffers and stream, decorator
{
- stream<test::stream> ws{ioc,
+ stream<test::basic_stream<net::io_context::executor_type>> ws{ioc,
"Connection: upgrade\r\n"
"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n"
"Sec-WebSocket-Version: 13\r\n"
n = s.size() - 1;
break;
}
- stream<test::stream> ws(ioc);
+ stream<test::basic_stream<net::io_context::executor_type>> ws(ioc);
auto tr = connect(ws.next_layer());
ws.next_layer().append(
s.substr(n, s.size() - n));
{
net::io_context ioc;
{
- stream<test::stream> ws(ioc);
+ stream<test::basic_stream<net::io_context::executor_type>> ws(ioc);
auto tr = connect(ws.next_layer());
tr.close();
try
}
}
{
- stream<test::stream> ws(ioc);
+ stream<test::basic_stream<net::io_context::executor_type>>
+ ws(ioc.get_executor());
auto tr = connect(ws.next_layer());
tr.close();
try
}
{
- stream<test::stream> ws1(ioc);
- stream<test::stream> ws2(ioc);
+ stream<test::basic_stream<net::io_context::executor_type>> ws1(ioc);
+ stream<test::basic_stream<net::io_context::executor_type>> ws2(ioc);
test::connect(ws1.next_layer(), ws2.next_layer());
ws1.async_handshake("test", "/", test::success_handler());
}
{
- stream<test::stream> ws1(ioc);
- stream<test::stream> ws2(ioc);
+ stream<test::basic_stream<net::io_context::executor_type>> ws1(ioc);
+ stream<test::basic_stream<net::io_context::executor_type>> ws2(ioc);
test::connect(ws1.next_layer(), ws2.next_layer());
ws1.set_option(stream_base::timeout{
}
{
- stream<test::stream> ws1(ioc);
- stream<test::stream> ws2(ioc);
+ stream<test::basic_stream<net::io_context::executor_type>> ws1(ioc);
+ stream<test::basic_stream<net::io_context::executor_type>> ws2(ioc);
test::connect(ws1.next_layer(), ws2.next_layer());
ws1.set_option(stream_base::timeout{