#include <boost/test/unit_test.hpp>
#include <websocketpp/common/thread.hpp>
#include <websocketpp/config/core.hpp>
#include <websocketpp/config/core_client.hpp>
#include <websocketpp/config/asio.hpp>
#include <websocketpp/config/asio_client.hpp>
#include <websocketpp/config/debug_asio.hpp>
#include <websocketpp/server.hpp>
#include <websocketpp/client.hpp>
Go to the source code of this file.
Classes | |
struct | config |
struct | config::transport_config |
struct | config_tls |
struct | config_tls::transport_config |
Macros | |
#define | BOOST_TEST_MODULE transport_integration |
Typedefs | |
typedef websocketpp::server< config > | server |
typedef websocketpp::client< config > | client |
typedef websocketpp::server< config_tls > | server_tls |
typedef websocketpp::client< config_tls > | client_tls |
typedef websocketpp::server< websocketpp::config::core > | iostream_server |
typedef websocketpp::client< websocketpp::config::core_client > | iostream_client |
Functions | |
template<typename T > | |
void | close_after_timeout (T &e, websocketpp::connection_hdl hdl, long timeout) |
void | run_server (server *s, int port, bool log=false) |
void | run_client (client &c, std::string uri, bool log=false) |
void | run_client_and_mark (client *c, bool *flag, websocketpp::lib::mutex *mutex) |
void | run_time_limited_client (client &c, std::string uri, long timeout, bool log) |
void | run_dummy_server (int port) |
void | run_dummy_client (std::string port) |
bool | on_ping (server *s, websocketpp::connection_hdl, std::string) |
void | cancel_on_open (server *s, websocketpp::connection_hdl) |
void | stop_on_close (server *s, websocketpp::connection_hdl hdl) |
template<typename T > | |
void | ping_on_open (T *c, std::string payload, websocketpp::connection_hdl hdl) |
void | fail_on_pong (websocketpp::connection_hdl, std::string) |
void | fail_on_pong_timeout (websocketpp::connection_hdl, std::string) |
void | req_pong (std::string expected_payload, websocketpp::connection_hdl, std::string payload) |
void | fail_on_open (websocketpp::connection_hdl) |
void | delay (websocketpp::connection_hdl, long duration) |
template<typename T > | |
void | check_ec (T *c, websocketpp::lib::error_code ec, websocketpp::connection_hdl hdl) |
template<typename T > | |
void | check_ec_and_stop (T *e, websocketpp::lib::error_code ec, websocketpp::connection_hdl hdl) |
template<typename T > | |
void | req_pong_timeout (T *c, std::string expected_payload, websocketpp::connection_hdl hdl, std::string payload) |
template<typename T > | |
void | close (T *e, websocketpp::connection_hdl hdl) |
void | run_test_timer (long value) |
BOOST_AUTO_TEST_CASE (pong_no_timeout) | |
BOOST_AUTO_TEST_CASE (pong_timeout) | |
BOOST_AUTO_TEST_CASE (client_open_handshake_timeout) | |
BOOST_AUTO_TEST_CASE (server_open_handshake_timeout) | |
BOOST_AUTO_TEST_CASE (client_self_initiated_close_handshake_timeout) | |
BOOST_AUTO_TEST_CASE (client_peer_initiated_close_handshake_timeout) | |
BOOST_AUTO_TEST_CASE (server_self_initiated_close_handshake_timeout) | |
BOOST_AUTO_TEST_CASE (client_runs_out_of_work) | |
BOOST_AUTO_TEST_CASE (client_is_perpetual) | |
BOOST_AUTO_TEST_CASE (client_failed_connection) | |
BOOST_AUTO_TEST_CASE (stop_listening) | |
BOOST_AUTO_TEST_CASE (pause_reading) | |
BOOST_AUTO_TEST_CASE (server_connection_cleanup) | |
#define BOOST_TEST_MODULE transport_integration |
Definition at line 28 of file integration.cpp.
typedef websocketpp::server<config> server |
Definition at line 125 of file integration.cpp.
typedef websocketpp::client<config> client |
Definition at line 126 of file integration.cpp.
typedef websocketpp::server<config_tls> server_tls |
Definition at line 128 of file integration.cpp.
typedef websocketpp::client<config_tls> client_tls |
Definition at line 129 of file integration.cpp.
Definition at line 131 of file integration.cpp.
Definition at line 132 of file integration.cpp.
void close_after_timeout | ( | T & | e, |
websocketpp::connection_hdl | hdl, | ||
long | timeout | ||
) |
Definition at line 139 of file integration.cpp.
References websocketpp::close::status::normal.
void run_server | ( | server * | s, |
int | port, | ||
bool | log = false |
||
) |
Definition at line 147 of file integration.cpp.
References websocketpp::log::elevel::all, websocketpp::log::alevel::all, websocketpp::endpoint< connection, config >::clear_access_channels(), websocketpp::endpoint< connection, config >::clear_error_channels(), websocketpp::transport::asio::endpoint< config >::init_asio(), websocketpp::transport::asio::endpoint< config >::listen(), websocketpp::transport::asio::endpoint< config >::run(), websocketpp::endpoint< connection, config >::set_access_channels(), websocketpp::endpoint< connection, config >::set_error_channels(), websocketpp::transport::asio::endpoint< config >::set_reuse_addr(), and websocketpp::server< config >::start_accept().
Referenced by BOOST_AUTO_TEST_CASE().
void run_client | ( | client & | c, |
std::string | uri, | ||
bool | log = false |
||
) |
Definition at line 164 of file integration.cpp.
References websocketpp::log::elevel::all, websocketpp::log::alevel::all, websocketpp::endpoint< connection, config >::clear_access_channels(), websocketpp::endpoint< connection, config >::clear_error_channels(), websocketpp::client< config >::connect(), websocketpp::client< config >::get_connection(), websocketpp::transport::asio::endpoint< config >::init_asio(), websocketpp::transport::asio::endpoint< config >::run(), websocketpp::endpoint< connection, config >::set_access_channels(), websocketpp::endpoint< connection, config >::set_error_channels(), and websocketpp::transport::asio::endpoint< config >::set_reuse_addr().
Referenced by BOOST_AUTO_TEST_CASE().
void run_client_and_mark | ( | client * | c, |
bool * | flag, | ||
websocketpp::lib::mutex * | mutex | ||
) |
Definition at line 184 of file integration.cpp.
References websocketpp::transport::asio::endpoint< config >::run().
Referenced by BOOST_AUTO_TEST_CASE().
void run_time_limited_client | ( | client & | c, |
std::string | uri, | ||
long | timeout, | ||
bool | log | ||
) |
Definition at line 192 of file integration.cpp.
References websocketpp::log::elevel::all, websocketpp::log::alevel::all, websocketpp::endpoint< connection, config >::clear_access_channels(), websocketpp::endpoint< connection, config >::clear_error_channels(), websocketpp::client< config >::connect(), websocketpp::client< config >::get_connection(), websocketpp::transport::asio::endpoint< config >::init_asio(), websocketpp::transport::asio::endpoint< config >::run(), websocketpp::endpoint< connection, config >::set_access_channels(), websocketpp::endpoint< connection, config >::set_error_channels(), and websocketpp::transport::error::timeout.
Referenced by BOOST_AUTO_TEST_CASE().
void run_dummy_server | ( | int | port | ) |
Definition at line 220 of file integration.cpp.
References websocketpp::transport::error::eof, and websocketpp::transport::asio::socket::error::socket.
Referenced by BOOST_AUTO_TEST_CASE().
void run_dummy_client | ( | std::string | port | ) |
Definition at line 247 of file integration.cpp.
References websocketpp::transport::error::eof, and websocketpp::transport::asio::socket::error::socket.
Referenced by BOOST_AUTO_TEST_CASE().
bool on_ping | ( | server * | s, |
websocketpp::connection_hdl | , | ||
std::string | |||
) |
Definition at line 276 of file integration.cpp.
References websocketpp::log::alevel::app, websocketpp::endpoint< connection, config >::get_alog(), and websocketpp::log::stub::write().
Referenced by BOOST_AUTO_TEST_CASE().
void cancel_on_open | ( | server * | s, |
websocketpp::connection_hdl | |||
) |
Definition at line 281 of file integration.cpp.
References websocketpp::transport::asio::endpoint< config >::stop_listening().
Referenced by BOOST_AUTO_TEST_CASE().
void stop_on_close | ( | server * | s, |
websocketpp::connection_hdl | hdl | ||
) |
Definition at line 285 of file integration.cpp.
References websocketpp::endpoint< connection, config >::get_con_from_hdl(), and websocketpp::transport::asio::endpoint< config >::stop().
Referenced by BOOST_AUTO_TEST_CASE().
void ping_on_open | ( | T * | c, |
std::string | payload, | ||
websocketpp::connection_hdl | hdl | ||
) |
Definition at line 293 of file integration.cpp.
void fail_on_pong | ( | websocketpp::connection_hdl | , |
std::string | |||
) |
Definition at line 300 of file integration.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
void fail_on_pong_timeout | ( | websocketpp::connection_hdl | , |
std::string | |||
) |
Definition at line 304 of file integration.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
void req_pong | ( | std::string | expected_payload, |
websocketpp::connection_hdl | , | ||
std::string | payload | ||
) |
Definition at line 308 of file integration.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
void fail_on_open | ( | websocketpp::connection_hdl | ) |
Definition at line 314 of file integration.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
void delay | ( | websocketpp::connection_hdl | , |
long | duration | ||
) |
Definition at line 318 of file integration.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), ns3::ndn::AppDelayTracer::PrintHeader(), ns3::AnnotatedTopologyReader::Read(), ns3::ndn::ConsumerBatches::ScheduleNextPacket(), and ndn::util::NotificationSubscriberBase::stop().
void check_ec | ( | T * | c, |
websocketpp::lib::error_code | ec, | ||
websocketpp::connection_hdl | hdl | ||
) |
Definition at line 323 of file integration.cpp.
void check_ec_and_stop | ( | T * | e, |
websocketpp::lib::error_code | ec, | ||
websocketpp::connection_hdl | hdl | ||
) |
Definition at line 333 of file integration.cpp.
void req_pong_timeout | ( | T * | c, |
std::string | expected_payload, | ||
websocketpp::connection_hdl | hdl, | ||
std::string | payload | ||
) |
Definition at line 344 of file integration.cpp.
References websocketpp::close::status::normal.
void close | ( | T * | e, |
websocketpp::connection_hdl | hdl | ||
) |
Definition at line 353 of file integration.cpp.
References websocketpp::close::status::normal.
Referenced by websocketpp::connection< stub_config >::buffered_amount(), websocketpp::endpoint< connection, config >::close(), websocketpp::connection< config >::close(), websocketpp::connection< config >::handle_read_frame(), and ndn::OBufferStream::~OBufferStream().
void run_test_timer | ( | long | value | ) |
Definition at line 358 of file integration.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
BOOST_AUTO_TEST_CASE | ( | pong_no_timeout | ) |
Definition at line 363 of file integration.cpp.
References fail_on_pong_timeout(), req_pong(), run_server(), run_time_limited_client(), websocketpp::endpoint< connection, config >::set_close_handler(), websocketpp::endpoint< connection, config >::set_open_handler(), websocketpp::endpoint< connection, config >::set_pong_handler(), websocketpp::endpoint< connection, config >::set_pong_timeout_handler(), and stop_on_close().
Referenced by BOOST_AUTO_TEST_CASE().
BOOST_AUTO_TEST_CASE | ( | pong_timeout | ) |
Definition at line 384 of file integration.cpp.
References fail_on_pong(), on_ping(), run_client(), run_server(), run_test_timer(), websocketpp::endpoint< connection, config >::set_close_handler(), websocketpp::endpoint< connection, config >::set_fail_handler(), websocketpp::endpoint< connection, config >::set_open_handler(), websocketpp::endpoint< connection, config >::set_ping_handler(), websocketpp::endpoint< connection, config >::set_pong_handler(), websocketpp::endpoint< connection, config >::set_pong_timeout_handler(), and stop_on_close().
BOOST_AUTO_TEST_CASE | ( | client_open_handshake_timeout | ) |
Definition at line 409 of file integration.cpp.
References fail_on_open(), websocketpp::error::open_handshake_timeout, run_client(), run_dummy_server(), run_test_timer(), websocketpp::endpoint< connection, config >::set_fail_handler(), and websocketpp::endpoint< connection, config >::set_open_handler().
BOOST_AUTO_TEST_CASE | ( | server_open_handshake_timeout | ) |
Definition at line 426 of file integration.cpp.
References fail_on_open(), websocketpp::error::open_handshake_timeout, run_dummy_client(), run_server(), run_test_timer(), websocketpp::endpoint< connection, config >::set_fail_handler(), and websocketpp::endpoint< connection, config >::set_open_handler().
BOOST_AUTO_TEST_CASE | ( | client_self_initiated_close_handshake_timeout | ) |
Definition at line 444 of file integration.cpp.
References websocketpp::error::close_handshake_timeout, delay(), run_client(), run_server(), run_test_timer(), websocketpp::endpoint< connection, config >::set_close_handler(), websocketpp::endpoint< connection, config >::set_open_handler(), and stop_on_close().
BOOST_AUTO_TEST_CASE | ( | client_peer_initiated_close_handshake_timeout | ) |
Definition at line 467 of file integration.cpp.
BOOST_AUTO_TEST_CASE | ( | server_self_initiated_close_handshake_timeout | ) |
BOOST_AUTO_TEST_CASE | ( | client_runs_out_of_work | ) |
Definition at line 499 of file integration.cpp.
References websocketpp::transport::asio::endpoint< config >::init_asio(), websocketpp::transport::asio::endpoint< config >::run(), and run_test_timer().
BOOST_AUTO_TEST_CASE | ( | client_is_perpetual | ) |
BOOST_AUTO_TEST_CASE | ( | client_failed_connection | ) |
Definition at line 552 of file integration.cpp.
References run_time_limited_client().
BOOST_AUTO_TEST_CASE | ( | stop_listening | ) |
Definition at line 558 of file integration.cpp.
References cancel_on_open(), run_client(), run_server(), run_test_timer(), and websocketpp::endpoint< connection, config >::set_open_handler().
BOOST_AUTO_TEST_CASE | ( | pause_reading | ) |
Definition at line 577 of file integration.cpp.
References websocketpp::server< config >::get_connection().
BOOST_AUTO_TEST_CASE | ( | server_connection_cleanup | ) |
Definition at line 607 of file integration.cpp.
References BOOST_AUTO_TEST_CASE().