28#define BOOST_TEST_MODULE client
29#include <boost/test/unit_test.hpp>
69 websocketpp::lib::error_code ec;
78 websocketpp::lib::error_code ec;
87 websocketpp::lib::error_code ec;
92 BOOST_CHECK_EQUAL( con->get_host() ,
"localhost" );
93 BOOST_CHECK_EQUAL( con->get_port() , 80 );
94 BOOST_CHECK_EQUAL( con->get_secure() ,
false );
95 BOOST_CHECK_EQUAL( con->get_resource() ,
"/" );
100 websocketpp::lib::error_code ec;
101 std::stringstream out;
104 c.register_ostream(&out);
111 r.consume(o.data(),o.size());
113 BOOST_CHECK(
r.ready() );
114 BOOST_CHECK_EQUAL(
r.get_method(),
"GET");
115 BOOST_CHECK_EQUAL(
r.get_version(),
"HTTP/1.1");
116 BOOST_CHECK_EQUAL(
r.get_uri(),
"/");
118 BOOST_CHECK_EQUAL(
r.get_header(
"Host"),
"localhost");
119 BOOST_CHECK_EQUAL(
r.get_header(
"Sec-WebSocket-Version"),
"13");
120 BOOST_CHECK_EQUAL(
r.get_header(
"Connection"),
"Upgrade");
121 BOOST_CHECK_EQUAL(
r.get_header(
"Upgrade"),
"websocket");
125 BOOST_CHECK_NE(
r.get_header(
"Sec-WebSocket-Key"),
"");
126 BOOST_CHECK_NE(
r.get_header(
"User-Agent"),
"" );
132 std::stringstream channel2;
133 channel2 <<
"e\r\n\r\n";
139 websocketpp::lib::error_code ec;
146 con->select_subprotocol(
"foo",ec);
153 websocketpp::lib::error_code ec;
159 con->add_subprotocol(
"",ec);
163 con->add_subprotocol(
"foo,bar",ec);
170 websocketpp::lib::error_code ec;
171 std::stringstream out;
174 c.register_ostream(&out);
179 con->add_subprotocol(
"foo",ec);
182 BOOST_CHECK_NO_THROW( con->add_subprotocol(
"bar") );
188 r.consume(o.data(),o.size());
190 BOOST_CHECK(
r.ready() );
191 BOOST_CHECK_EQUAL(
r.get_header(
"Sec-WebSocket-Protocol"),
"foo, bar");
Client endpoint role based on the given config.
connection_ptr connect(connection_ptr con)
Begin the connection process for the given connection.
connection_ptr get_connection(uri_ptr location, lib::error_code &ec)
Get a new connection.
connection_type::ptr connection_ptr
Stores, parses, and manipulates HTTP requests.
Thread safe non-deterministic random integer generator.
BOOST_AUTO_TEST_CASE(invalid_uri)
websocketpp::client< stub_config > client
client::connection_ptr connection_ptr
@ server_only
Attempted to use a server specific feature on a client endpoint.
@ endpoint_not_secure
Attempted to open a secure connection with an insecure endpoint.
@ invalid_subprotocol
Invalid subprotocol.
@ invalid_uri
An invalid uri was supplied.
lib::error_code make_error_code(error::value e)
uint32_t level
Type of a channel package.
core::alog_type alog_type
core::endpoint_msg_manager_type endpoint_msg_manager_type
core::elog_type elog_type
core::message_type message_type
static const websocketpp::log::level alog_level
core::endpoint_base endpoint_base
core::transport_type transport_type
core::con_msg_manager_type con_msg_manager_type
static const websocketpp::log::level elog_level
core::request_type request_type
core::concurrency_type concurrency_type
websocketpp::random::random_device::int_generator< uint32_t, concurrency_type > rng_type
core::response_type response_type
Server config with iostream transport.
static level const none
Special aggregate value representing "no levels".
static level const none
Special aggregate value representing "no levels".