NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
integration.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, Peter Thorson. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution.
11  * * Neither the name of the WebSocket++ Project nor the
12  * names of its contributors may be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL PETER THORSON BE LIABLE FOR ANY
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  */
27 //#define BOOST_TEST_DYN_LINK
28 #define BOOST_TEST_MODULE transport_integration
29 #include <boost/test/unit_test.hpp>
30 
32 
38 #include <websocketpp/server.hpp>
39 #include <websocketpp/client.hpp>
40 
42  typedef config type;
44 
46 
49 
53 
56 
58 
67  };
68 
71 
72  //static const websocketpp::log::level elog_level = websocketpp::log::elevel::all;
73  //static const websocketpp::log::level alog_level = websocketpp::log::alevel::all;
74 
76  static const long timeout_open_handshake = 500;
78  static const long timeout_close_handshake = 500;
80  static const long timeout_pong = 500;
81 };
82 
84  typedef config type;
86 
88 
91 
95 
98 
100 
109  };
110 
113 
114  //static const websocketpp::log::level elog_level = websocketpp::log::elevel::all;
115  //static const websocketpp::log::level alog_level = websocketpp::log::alevel::all;
116 
118  static const long timeout_open_handshake = 500;
120  static const long timeout_close_handshake = 500;
122  static const long timeout_pong = 500;
123 };
124 
127 
130 
133 
134 using websocketpp::lib::placeholders::_1;
135 using websocketpp::lib::placeholders::_2;
136 using websocketpp::lib::bind;
137 
138 template <typename T>
140  sleep(timeout);
141 
142  websocketpp::lib::error_code ec;
143  e.close(hdl,websocketpp::close::status::normal,"",ec);
144  BOOST_CHECK(!ec);
145 }
146 
147 void run_server(server * s, int port, bool log = false) {
148  if (log) {
151  } else {
154  }
155 
156  s->init_asio();
157  s->set_reuse_addr(true);
158 
159  s->listen(port);
160  s->start_accept();
161  s->run();
162 }
163 
164 void run_client(client & c, std::string uri, bool log = false) {
165  if (log) {
168  } else {
171  }
172  websocketpp::lib::error_code ec;
173  c.init_asio(ec);
174  c.set_reuse_addr(true);
175  BOOST_CHECK(!ec);
176 
177  client::connection_ptr con = c.get_connection(uri,ec);
178  BOOST_CHECK( !ec );
179  c.connect(con);
180 
181  c.run();
182 }
183 
184 void run_client_and_mark(client * c, bool * flag, websocketpp::lib::mutex * mutex) {
185  c->run();
186  BOOST_CHECK( true );
187  websocketpp::lib::lock_guard<websocketpp::lib::mutex> lock(*mutex);
188  *flag = true;
189  BOOST_CHECK( true );
190 }
191 
192 void run_time_limited_client(client & c, std::string uri, long timeout,
193  bool log)
194 {
195  if (log) {
198  } else {
201  }
202  c.init_asio();
203 
204  websocketpp::lib::error_code ec;
205  client::connection_ptr con = c.get_connection(uri,ec);
206  BOOST_CHECK( !ec );
207  c.connect(con);
208 
209  websocketpp::lib::thread tthread(websocketpp::lib::bind(
210  &close_after_timeout<client>,
211  websocketpp::lib::ref(c),
212  con->get_handle(),
213  timeout
214  ));
215  tthread.detach();
216 
217  c.run();
218 }
219 
220 void run_dummy_server(int port) {
221  using boost::asio::ip::tcp;
222 
223  try {
224  boost::asio::io_service io_service;
225  tcp::acceptor acceptor(io_service, tcp::endpoint(tcp::v6(), port));
226  tcp::socket socket(io_service);
227 
228  acceptor.accept(socket);
229  for (;;) {
230  char data[512];
231  boost::system::error_code ec;
232  socket.read_some(boost::asio::buffer(data), ec);
233  if (ec == boost::asio::error::eof) {
234  break;
235  } else if (ec) {
236  // other error
237  throw ec;
238  }
239  }
240  } catch (std::exception & e) {
241  std::cout << e.what() << std::endl;
242  } catch (boost::system::error_code & ec) {
243  std::cout << ec.message() << std::endl;
244  }
245 }
246 
247 void run_dummy_client(std::string port) {
248  using boost::asio::ip::tcp;
249 
250  try {
251  boost::asio::io_service io_service;
252  tcp::resolver resolver(io_service);
253  tcp::resolver::query query("localhost", port);
254  tcp::resolver::iterator iterator = resolver.resolve(query);
255  tcp::socket socket(io_service);
256 
257  boost::asio::connect(socket, iterator);
258  for (;;) {
259  char data[512];
260  boost::system::error_code ec;
261  socket.read_some(boost::asio::buffer(data), ec);
262  if (ec == boost::asio::error::eof) {
263  break;
264  } else if (ec) {
265  // other error
266  throw ec;
267  }
268  }
269  } catch (std::exception & e) {
270  std::cout << e.what() << std::endl;
271  } catch (boost::system::error_code & ec) {
272  std::cout << ec.message() << std::endl;
273  }
274 }
275 
276 bool on_ping(server * s, websocketpp::connection_hdl, std::string) {
277  s->get_alog().write(websocketpp::log::alevel::app,"got ping");
278  return false;
279 }
280 
282  s->stop_listening();
283 }
284 
287  //BOOST_CHECK_EQUAL( con->get_local_close_code(), websocketpp::close::status::normal );
288  //BOOST_CHECK_EQUAL( con->get_remote_close_code(), websocketpp::close::status::normal );
289  s->stop();
290 }
291 
292 template <typename T>
293 void ping_on_open(T * c, std::string payload, websocketpp::connection_hdl hdl) {
294  typename T::connection_ptr con = c->get_con_from_hdl(hdl);
295  websocketpp::lib::error_code ec;
296  con->ping(payload,ec);
297  BOOST_CHECK_EQUAL(ec, websocketpp::lib::error_code());
298 }
299 
301  BOOST_FAIL( "expected no pong handler" );
302 }
303 
305  BOOST_FAIL( "expected no pong timeout" );
306 }
307 
308 void req_pong(std::string expected_payload, websocketpp::connection_hdl,
309  std::string payload)
310 {
311  BOOST_CHECK_EQUAL( expected_payload, payload );
312 }
313 
315  BOOST_FAIL( "expected no open handler" );
316 }
317 
319  sleep(duration);
320 }
321 
322 template <typename T>
323 void check_ec(T * c, websocketpp::lib::error_code ec,
325 {
326  typename T::connection_ptr con = c->get_con_from_hdl(hdl);
327  BOOST_CHECK_EQUAL( con->get_ec(), ec );
328  //BOOST_CHECK_EQUAL( con->get_local_close_code(), websocketpp::close::status::normal );
329  //BOOST_CHECK_EQUAL( con->get_remote_close_code(), websocketpp::close::status::normal );
330 }
331 
332 template <typename T>
333 void check_ec_and_stop(T * e, websocketpp::lib::error_code ec,
335 {
336  typename T::connection_ptr con = e->get_con_from_hdl(hdl);
337  BOOST_CHECK_EQUAL( con->get_ec(), ec );
338  //BOOST_CHECK_EQUAL( con->get_local_close_code(), websocketpp::close::status::normal );
339  //BOOST_CHECK_EQUAL( con->get_remote_close_code(), websocketpp::close::status::normal );
340  e->stop();
341 }
342 
343 template <typename T>
344 void req_pong_timeout(T * c, std::string expected_payload,
345  websocketpp::connection_hdl hdl, std::string payload)
346 {
347  typename T::connection_ptr con = c->get_con_from_hdl(hdl);
348  BOOST_CHECK_EQUAL( payload, expected_payload );
349  con->close(websocketpp::close::status::normal,"");
350 }
351 
352 template <typename T>
354  e->get_con_from_hdl(hdl)->close(websocketpp::close::status::normal,"");
355 }
356 
358 {
359 public:
361  : m_timer(m_io_service, boost::posix_time::seconds(seconds))
362  {
363  m_timer.async_wait(bind(&test_deadline_timer::expired, this, ::_1));
364  std::size_t (boost::asio::io_service::*run)() = &boost::asio::io_service::run;
365  m_timer_thread = websocketpp::lib::thread(websocketpp::lib::bind(run, &m_io_service));
366  }
368  {
369  m_timer.cancel();
370  m_timer_thread.join();
371  }
372 
373  private:
374  void expired(const boost::system::error_code & ec)
375  {
377  return;
378  BOOST_CHECK(!ec);
379  BOOST_FAIL("Test timed out");
380  }
381 
382  boost::asio::io_service m_io_service;
383  boost::asio::deadline_timer m_timer;
384  websocketpp::lib::thread m_timer_thread;
385 };
386 
387 BOOST_AUTO_TEST_CASE( pong_no_timeout ) {
388  server s;
389  client c;
390 
391  s.set_close_handler(bind(&stop_on_close,&s,::_1));
392 
393  // send a ping when the connection is open
394  c.set_open_handler(bind(&ping_on_open<client>,&c,"foo",::_1));
395  // require that a pong with matching payload is received
396  c.set_pong_handler(bind(&req_pong,"foo",::_1,::_2));
397  // require that a pong timeout is NOT received
399 
400  websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
401 
402  sleep(1); // give the server thread some time to start
403 
404  // Run a client that closes the connection after 1 seconds
405  run_time_limited_client(c, "http://localhost:9005", 1, false);
406 
407  sthread.join();
408 }
409 
410 BOOST_AUTO_TEST_CASE( pong_timeout ) {
411  server s;
412  client c;
413 
414  s.set_ping_handler(bind(&on_ping, &s,::_1,::_2));
415  s.set_close_handler(bind(&stop_on_close,&s,::_1));
416 
417  c.set_fail_handler(bind(&check_ec<client>,&c,
418  websocketpp::lib::error_code(),::_1));
419 
420  c.set_pong_handler(bind(&fail_on_pong,::_1,::_2));
421  c.set_open_handler(bind(&ping_on_open<client>,&c,"foo",::_1));
422  c.set_pong_timeout_handler(bind(&req_pong_timeout<client>,&c,"foo",::_1,::_2));
423  c.set_close_handler(bind(&check_ec<client>,&c,
424  websocketpp::lib::error_code(),::_1));
425 
426  websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
427  sleep(1); // give the server thread some time to start
428 
429  test_deadline_timer deadline(10);
430 
431  run_client(c, "http://localhost:9005",false);
432 
433  sthread.join();
434 }
435 
436 BOOST_AUTO_TEST_CASE( client_open_handshake_timeout ) {
437  client c;
438 
439  // set open handler to fail test
440  c.set_open_handler(bind(&fail_on_open,::_1));
441  // set fail hander to test for the right fail error code
442  c.set_fail_handler(bind(&check_ec<client>,&c,
444 
445  websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_dummy_server,9005));
446  sthread.detach();
447 
448  sleep(1); // give the server thread some time to start
449 
450  test_deadline_timer deadline(10);
451 
452  run_client(c, "http://localhost:9005");
453 }
454 
455 BOOST_AUTO_TEST_CASE( server_open_handshake_timeout ) {
456  server s;
457 
458  // set open handler to fail test
459  s.set_open_handler(bind(&fail_on_open,::_1));
460  // set fail hander to test for the right fail error code
461  s.set_fail_handler(bind(&check_ec_and_stop<server>,&s,
463 
464  websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
465 
466  test_deadline_timer deadline(10);
467 
468  sleep(1); // give the server thread some time to start
469 
470  run_dummy_client("9005");
471 
472  sthread.join();
473 }
474 
475 BOOST_AUTO_TEST_CASE( client_self_initiated_close_handshake_timeout ) {
476  server s;
477  client c;
478 
479  // on open server sleeps for longer than the timeout
480  // on open client sends close handshake
481  // client handshake timer should be triggered
482  s.set_open_handler(bind(&delay,::_1,1));
483  s.set_close_handler(bind(&stop_on_close,&s,::_1));
484 
485  c.set_open_handler(bind(&close<client>,&c,::_1));
486  c.set_close_handler(bind(&check_ec<client>,&c,
488 
489  websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
490 
491  test_deadline_timer deadline(10);
492 
493  sleep(1); // give the server thread some time to start
494 
495  run_client(c, "http://localhost:9005", false);
496 
497  sthread.join();
498 }
499 
500 BOOST_AUTO_TEST_CASE( client_peer_initiated_close_handshake_timeout ) {
501  // on open server sends close
502  // client should ack normally and then wait
503  // server leaves TCP connection open
504  // client handshake timer should be triggered
505 
506  // TODO: how to make a mock server that leaves the TCP connection open?
507 }
508 
509 BOOST_AUTO_TEST_CASE( server_self_initiated_close_handshake_timeout ) {
510  server s;
511  client c;
512 
513  // on open server sends close
514  // on open client sleeps for longer than the timeout
515  // server handshake timer should be triggered
516 
517  s.set_open_handler(bind(&close<server>,&s,::_1));
518  s.set_close_handler(bind(&check_ec_and_stop<server>,&s,
520 
521  c.set_open_handler(bind(&delay,::_1,1));
522 
523  websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
524  test_deadline_timer deadline(10);
525 
526  sleep(1); // give the server thread some time to start
527 
528  run_client(c, "http://localhost:9005", false);
529 
530  sthread.join();
531 }
532 
533 BOOST_AUTO_TEST_CASE( client_runs_out_of_work ) {
534  client c;
535 
536  test_deadline_timer deadline(3);
537 
538  websocketpp::lib::error_code ec;
539  c.init_asio(ec);
540  BOOST_CHECK(!ec);
541 
542  c.run();
543 
544  // This test checks that an io_service with no work ends immediately.
545  BOOST_CHECK(true);
546 }
547 
548 
549 
550 
551 BOOST_AUTO_TEST_CASE( client_is_perpetual ) {
552  client c;
553  bool flag = false;
554  websocketpp::lib::mutex mutex;
555 
556  websocketpp::lib::error_code ec;
557  c.init_asio(ec);
558  BOOST_CHECK(!ec);
559 
560  c.start_perpetual();
561 
562  websocketpp::lib::thread cthread(websocketpp::lib::bind(&run_client_and_mark,&c,&flag,&mutex));
563 
564  sleep(1);
565 
566  {
567  // Checks that the thread hasn't exited yet
568  websocketpp::lib::lock_guard<websocketpp::lib::mutex> lock(mutex);
569  BOOST_CHECK( !flag );
570  }
571 
572  c.stop_perpetual();
573 
574  sleep(1);
575 
576  {
577  // Checks that the thread has exited
578  websocketpp::lib::lock_guard<websocketpp::lib::mutex> lock(mutex);
579  BOOST_CHECK( flag );
580  }
581 
582  cthread.join();
583 }
584 
585 BOOST_AUTO_TEST_CASE( client_failed_connection ) {
586  client c;
587 
588  run_time_limited_client(c,"http://localhost:9005", 5, false);
589 }
590 
591 BOOST_AUTO_TEST_CASE( stop_listening ) {
592  server s;
593  client c;
594 
595  // the first connection stops the server from listening
596  s.set_open_handler(bind(&cancel_on_open,&s,::_1));
597 
598  // client immediately closes after opening a connection
599  c.set_open_handler(bind(&close<client>,&c,::_1));
600 
601  websocketpp::lib::thread sthread(websocketpp::lib::bind(&run_server,&s,9005,false));
602  test_deadline_timer deadline(5);
603 
604  sleep(1); // give the server thread some time to start
605 
606  run_client(c, "http://localhost:9005", false);
607 
608  sthread.join();
609 }
610 
611 BOOST_AUTO_TEST_CASE( pause_reading ) {
612  iostream_server s;
613  std::string handshake = "GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n\r\n";
614  char buffer[2] = { char(0x81), char(0x80) };
615 
616  // suppress output (it needs a place to go to avoid error but we don't care what it is)
617  std::stringstream null_output;
618  s.register_ostream(&null_output);
619 
621  con->start();
622 
623  // read handshake, should work
624  BOOST_CHECK_EQUAL( con->read_some(handshake.data(), handshake.length()), handshake.length());
625 
626  // pause reading and try again. The first read should work, the second should return 0
627  // the first read was queued already after the handshake so it will go through because
628  // reading wasn't paused when it was queued. The byte it reads wont be enough to
629  // complete the frame so another read will be requested. This one wont actually happen
630  // because the connection is paused now.
631  con->pause_reading();
632  BOOST_CHECK_EQUAL( con->read_some(buffer, 1), 1);
633  BOOST_CHECK_EQUAL( con->read_some(buffer+1, 1), 0);
634  // resume reading and try again. Should work this time because the resume should have
635  // re-queued a read.
636  con->resume_reading();
637  BOOST_CHECK_EQUAL( con->read_some(buffer+1, 1), 1);
638 }
639 
640 
641 BOOST_AUTO_TEST_CASE( server_connection_cleanup ) {
642  server_tls s;
643 }
644 
645 #ifdef _WEBSOCKETPP_MOVE_SEMANTICS_
646 BOOST_AUTO_TEST_CASE( move_construct_transport ) {
647  server s1;
648 
649  server s2(std::move(s1));
650 }
651 #endif // _WEBSOCKETPP_MOVE_SEMANTICS_
static level const all
Special aggregate value representing "all levels".
Definition: levels.hpp:152
connection_type::ptr connection_ptr
Type of a shared pointer to the connections this server will create.
static const long timeout_open_handshake
Length of time before an opening handshake is aborted.
Definition: integration.cpp:76
base::message_type message_type
Definition: integration.cpp:50
base::response_type response_type
Definition: integration.cpp:48
Asio based endpoint transport component.
Definition: base.hpp:143
boost::chrono::seconds seconds
Definition: time.hpp:47
void set_pong_timeout_handler(pong_timeout_handler h)
Definition: endpoint.hpp:302
Client config with asio transport and TLS enabled.
Definition: asio_client.hpp:43
test_deadline_timer(int seconds)
void fail_on_pong(websocketpp::connection_hdl, std::string)
type::response_type response_type
Definition: integration.cpp:64
Definition: block.hpp:32
void set_open_handler(open_handler h)
Definition: endpoint.hpp:277
type::concurrency_type concurrency_type
Definition: integration.cpp:60
type::request_type request_type
Definition: integration.cpp:63
span_CONFIG_SIZE_TYPE size_t
Definition: span-lite.hpp:565
void fail_on_pong_timeout(websocketpp::connection_hdl, std::string)
static level const app
Special channel for application specific logs. Not used by the library.
Definition: levels.hpp:143
websocketpp::config::asio base
Definition: integration.cpp:43
base::request_type request_type
Definition: integration.cpp:47
static const long timeout_pong
Length of time to wait for a pong after a ping.
Definition: integration.cpp:80
Client endpoint role based on the given config.
Concurrency policy that uses std::mutex / boost::mutex.
Definition: basic.hpp:37
base::con_msg_manager_type con_msg_manager_type
Definition: integration.cpp:93
base::response_type response_type
Definition: integration.cpp:90
websocketpp::transport::asio::endpoint< transport_config > transport_type
Definition: integration.cpp:70
static value const normal
Normal closure, meaning that the purpose for which the connection was established has been fulfilled...
Definition: close.hpp:76
lib::weak_ptr< void > connection_hdl
A handle to uniquely identify a connection.
alog_type & get_alog()
Get reference to access logger.
Definition: endpoint.hpp:261
boost::chrono::duration< Rep, Period > duration
Definition: time.hpp:34
base::elog_type elog_type
Definition: integration.cpp:97
base::concurrency_type concurrency_type
Definition: integration.cpp:45
connection_ptr get_con_from_hdl(connection_hdl hdl, lib::error_code &ec)
Retrieves a connection_ptr from a connection_hdl (exception free)
Definition: endpoint.hpp:643
base::rng_type rng_type
Definition: integration.cpp:57
void run_time_limited_client(client &c, std::string uri, long timeout, bool log)
void set_ping_handler(ping_handler h)
Definition: endpoint.hpp:292
void set_close_handler(close_handler h)
Definition: endpoint.hpp:282
type::request_type request_type
connection_ptr connect(connection_ptr con)
Begin the connection process for the given connection.
websocketpp::transport::asio::endpoint< transport_config > transport_type
Stores, parses, and manipulates HTTP responses.
Definition: response.hpp:57
base::alog_type alog_type
Definition: integration.cpp:96
websocketpp::transport::asio::basic_socket::endpoint socket_type
Definition: integration.cpp:66
type::concurrency_type concurrency_type
void run_dummy_server(int port)
type::response_type response_type
config type
Definition: integration.cpp:84
void req_pong(std::string expected_payload, websocketpp::connection_hdl, std::string payload)
void req_pong_timeout(T *c, std::string expected_payload, websocketpp::connection_hdl hdl, std::string payload)
Basic logger that outputs to an ostream.
Definition: basic.hpp:59
websocketpp::client< config > client
base::endpoint_msg_manager_type endpoint_msg_manager_type
Definition: integration.cpp:52
type::elog_type elog_type
Definition: integration.cpp:62
websocketpp::client< websocketpp::config::core_client > iostream_client
void stop_on_close(server *s, websocketpp::connection_hdl hdl)
void start_accept(lib::error_code &ec)
Starts the server&#39;s async connection acceptance loop (exception free)
base::endpoint_msg_manager_type endpoint_msg_manager_type
Definition: integration.cpp:94
Server endpoint role based on the given config.
Thread safe stub "random" integer generator.
Definition: none.hpp:46
void set_pong_handler(pong_handler h)
Definition: endpoint.hpp:297
void clear_error_channels(log::level channels)
Clear Error logging channels.
Definition: endpoint.hpp:253
void set_access_channels(log::level channels)
Set Access logging channel.
Definition: endpoint.hpp:220
void delay(websocketpp::connection_hdl, long duration)
Represents a buffer for a single WebSocket message.
Definition: message.hpp:84
Stub concurrency policy that implements the interface using no-ops.
Definition: none.hpp:60
void close(T *e, websocketpp::connection_hdl hdl)
base::request_type request_type
Definition: integration.cpp:89
Basic ASIO endpoint socket component.
Definition: none.hpp:318
void set_fail_handler(fail_handler h)
Definition: endpoint.hpp:287
base::con_msg_manager_type con_msg_manager_type
Definition: integration.cpp:51
void run_client(client &c, std::string uri, bool log=false)
base::rng_type rng_type
Definition: integration.cpp:99
websocketpp::server< websocketpp::config::core > iostream_server
websocketpp::config::asio base
Definition: integration.cpp:85
websocketpp::server< config > server
config type
Definition: integration.cpp:42
base::concurrency_type concurrency_type
Definition: integration.cpp:87
WebSocket close handshake timed out.
Definition: error.hpp:117
connection_ptr get_connection()
Create and initialize a new connection.
type::alog_type alog_type
Definition: integration.cpp:61
websocketpp::client< config_tls > client_tls
void clear_access_channels(log::level channels)
Clear Access logging channels.
Definition: endpoint.hpp:231
base::elog_type elog_type
Definition: integration.cpp:55
base::message_type message_type
Definition: integration.cpp:92
void check_ec(T *c, websocketpp::lib::error_code ec, websocketpp::connection_hdl hdl)
void set_error_channels(log::level channels)
Set Error logging channel.
Definition: endpoint.hpp:242
Stores, parses, and manipulates HTTP requests.
Definition: request.hpp:50
connection_type::ptr connection_ptr
Type of a shared pointer to the connections this server will create.
bool on_ping(server *s, websocketpp::connection_hdl, std::string)
client::connection_ptr connection_ptr
void run_client_and_mark(client *c, bool *flag, websocketpp::lib::mutex *mutex)
websocketpp::server< config_tls > server_tls
Catch-all error for socket component errors that don&#39;t fit in other categories.
Definition: base.hpp:83
WebSocket opening handshake timed out.
Definition: error.hpp:114
void close_after_timeout(T &e, websocketpp::connection_hdl hdl, long timeout)
void check_ec_and_stop(T *e, websocketpp::lib::error_code ec, websocketpp::connection_hdl hdl)
void fail_on_open(websocketpp::connection_hdl)
base::alog_type alog_type
Definition: integration.cpp:54
Client config with asio transport and TLS disabled.
static const long timeout_close_handshake
Length of time before a closing handshake is aborted.
Definition: integration.cpp:78
void run_server(server *s, int port, bool log=false)
A connection message manager that allocates a new message for each request.
Definition: alloc.hpp:41
void ping_on_open(T *c, std::string payload, websocketpp::connection_hdl hdl)
void run_dummy_client(std::string port)
An endpoint message manager that allocates a new manager for each connection.
Definition: alloc.hpp:88
static level const all
Special aggregate value representing "all levels".
Definition: levels.hpp:80
Stub logger that ignores all input.
Definition: stub.hpp:41
connection_ptr get_connection(uri_ptr location, lib::error_code &ec)
Get a new connection.
websocketpp::transport::asio::basic_socket::endpoint socket_type
Server config with asio transport and TLS disabled.
Definition: asio_no_tls.hpp:38
void cancel_on_open(server *s, websocketpp::connection_hdl)
BOOST_AUTO_TEST_CASE(pong_no_timeout)