#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 |
class | test_deadline_timer |
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) |
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::endpoint< connection, config >::set_access_channels(), websocketpp::endpoint< connection, config >::set_error_channels(), 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::endpoint< connection, config >::set_access_channels(), and websocketpp::endpoint< connection, config >::set_error_channels().
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.
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::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, and websocketpp::endpoint< connection, config >::get_alog().
Referenced by BOOST_AUTO_TEST_CASE().
void cancel_on_open | ( | server * | s, |
websocketpp::connection_hdl | |||
) |
Definition at line 281 of file integration.cpp.
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().
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< websocketpp::config::asio >, websocketpp::config::asio >::close(), websocketpp::connection< stub_config >::close(), websocketpp::connection< stub_config >::handle_read_frame(), nfd::face::NFD_FINAL_UNLESS_WITH_TESTS::setChannel(), and ndn::OBufferStream::~OBufferStream().
BOOST_AUTO_TEST_CASE | ( | pong_no_timeout | ) |
Definition at line 387 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 410 of file integration.cpp.
References fail_on_pong(), on_ping(), run_client(), run_server(), 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 | ) |
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 | ) |
Definition at line 500 of file integration.cpp.
BOOST_AUTO_TEST_CASE | ( | server_self_initiated_close_handshake_timeout | ) |
Definition at line 509 of file integration.cpp.
References websocketpp::error::close_handshake_timeout, delay(), run_client(), run_server(), websocketpp::endpoint< connection, config >::set_close_handler(), and websocketpp::endpoint< connection, config >::set_open_handler().
BOOST_AUTO_TEST_CASE | ( | client_runs_out_of_work | ) |
Definition at line 533 of file integration.cpp.
BOOST_AUTO_TEST_CASE | ( | client_is_perpetual | ) |
Definition at line 551 of file integration.cpp.
References run_client_and_mark().
BOOST_AUTO_TEST_CASE | ( | client_failed_connection | ) |
Definition at line 585 of file integration.cpp.
References run_time_limited_client().
BOOST_AUTO_TEST_CASE | ( | stop_listening | ) |
Definition at line 591 of file integration.cpp.
References cancel_on_open(), run_client(), run_server(), and websocketpp::endpoint< connection, config >::set_open_handler().
BOOST_AUTO_TEST_CASE | ( | pause_reading | ) |
Definition at line 611 of file integration.cpp.
References websocketpp::server< config >::get_connection().
BOOST_AUTO_TEST_CASE | ( | server_connection_cleanup | ) |
Definition at line 641 of file integration.cpp.
References BOOST_AUTO_TEST_CASE(), and nonstd::optional_lite::std11::move().