Go to the source code of this file.
◆ BOOST_TEST_MODULE
#define BOOST_TEST_MODULE client |
◆ client
◆ BOOST_AUTO_TEST_CASE() [1/7]
BOOST_AUTO_TEST_CASE |
( |
add_subprotocols | | ) |
|
Definition at line 168 of file client.cpp.
168 {
170 websocketpp::lib::error_code ec;
171 std::stringstream out;
172 std::string o;
173
174 c.register_ostream(&out);
175
177 BOOST_CHECK( con );
178
179 con->add_subprotocol("foo",ec);
180 BOOST_CHECK( !ec );
181
182 BOOST_CHECK_NO_THROW( con->add_subprotocol("bar") );
183
185
186 o = out.str();
188 r.consume(o.data(),o.size());
189
190 BOOST_CHECK(
r.ready() );
191 BOOST_CHECK_EQUAL(
r.get_header(
"Sec-WebSocket-Protocol"),
"foo, bar");
192}
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.
Stores, parses, and manipulates HTTP requests.
client::connection_ptr connection_ptr
◆ BOOST_AUTO_TEST_CASE() [2/7]
BOOST_AUTO_TEST_CASE |
( |
add_subprotocols_invalid | | ) |
|
Definition at line 151 of file client.cpp.
151 {
153 websocketpp::lib::error_code ec;
155
157 BOOST_CHECK( con );
158
159 con->add_subprotocol("",ec);
162
163 con->add_subprotocol("foo,bar",ec);
166}
@ invalid_subprotocol
Invalid subprotocol.
lib::error_code make_error_code(error::value e)
◆ BOOST_AUTO_TEST_CASE() [3/7]
BOOST_AUTO_TEST_CASE |
( |
connect_con | | ) |
|
Definition at line 98 of file client.cpp.
98 {
100 websocketpp::lib::error_code ec;
101 std::stringstream out;
102 std::string o;
103
104 c.register_ostream(&out);
105
108
109 o = out.str();
111 r.consume(o.data(),o.size());
112
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(),
"/");
117
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");
122
123
124
125 BOOST_CHECK_NE(
r.get_header(
"Sec-WebSocket-Key"),
"");
126 BOOST_CHECK_NE(
r.get_header(
"User-Agent"),
"" );
127
128
129
130
131
132 std::stringstream channel2;
133 channel2 << "e\r\n\r\n";
134 channel2 >> *con;
135}
◆ BOOST_AUTO_TEST_CASE() [4/7]
BOOST_AUTO_TEST_CASE |
( |
get_connection | | ) |
|
Definition at line 85 of file client.cpp.
85 {
87 websocketpp::lib::error_code ec;
88
90
91 BOOST_CHECK( con );
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() , "/" );
96}
◆ BOOST_AUTO_TEST_CASE() [5/7]
BOOST_AUTO_TEST_CASE |
( |
invalid_uri | | ) |
|
Definition at line 67 of file client.cpp.
67 {
69 websocketpp::lib::error_code ec;
70
72
74}
@ invalid_uri
An invalid uri was supplied.
◆ BOOST_AUTO_TEST_CASE() [6/7]
BOOST_AUTO_TEST_CASE |
( |
select_subprotocol | | ) |
|
Definition at line 137 of file client.cpp.
137 {
139 websocketpp::lib::error_code ec;
141
143
144 BOOST_CHECK( con );
145
146 con->select_subprotocol("foo",ec);
149}
@ server_only
Attempted to use a server specific feature on a client endpoint.
◆ BOOST_AUTO_TEST_CASE() [7/7]
BOOST_AUTO_TEST_CASE |
( |
unsecure_endpoint | | ) |
|
Definition at line 76 of file client.cpp.
76 {
78 websocketpp::lib::error_code ec;
79
81
83}
@ endpoint_not_secure
Attempted to open a secure connection with an insecure endpoint.