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);
113 BOOST_CHECK( r.
ready() );
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") );
190 BOOST_CHECK( r.
ready() );
191 BOOST_CHECK_EQUAL( r.
get_header(
"Sec-WebSocket-Protocol"),
"foo, bar");
connection_type::ptr connection_ptr
Type of a shared pointer to the connections this server will create.
static level const none
Special aggregate value representing "no levels".
lib::error_code make_error_code(error::value e)
core::con_msg_manager_type con_msg_manager_type
core::message_type message_type
core::endpoint_base endpoint_base
core::transport_type transport_type
Client endpoint role based on the given config.
stub_config::con_msg_manager_type con_msg_manager_type
websocketpp::random::random_device::int_generator< uint32_t, concurrency_type > rng_type
std::string const & get_uri() const
Return the requested URI.
connection_ptr connect(connection_ptr con)
Begin the connection process for the given connection.
BOOST_AUTO_TEST_CASE(invalid_uri)
core::elog_type elog_type
std::string const & get_header(std::string const &key) const
Get the value of an HTTP header.
static const websocketpp::log::level elog_level
core::endpoint_msg_manager_type endpoint_msg_manager_type
static level const none
Special aggregate value representing "no levels".
client::connection_ptr connection_ptr
std::string const & get_version() const
Get the HTTP version string.
websocketpp::client< stub_config > client
core::alog_type alog_type
core::concurrency_type concurrency_type
core::request_type request_type
Thread safe non-deterministic random integer generator.
Stores, parses, and manipulates HTTP requests.
static const websocketpp::log::level alog_level
size_t consume(char const *buf, size_t len)
Process bytes in the input buffer.
client::connection_ptr connection_ptr
core::response_type response_type
uint32_t level
Type of a channel package.
Attempted to use a server specific feature on a client endpoint.
Attempted to open a secure connection with an insecure endpoint.
connection_ptr get_connection(uri_ptr location, lib::error_code &ec)
Get a new connection.
bool ready() const
Returns whether or not the request is ready for reading.
An invalid uri was supplied.
Server config with iostream transport.
std::string const & get_method() const
Return the request method.