28 #define BOOST_TEST_MODULE transport_asio_timers 29 #include <boost/test/unit_test.hpp> 50 #include <boost/asio.hpp> 54 using boost::asio::ip::tcp;
57 boost::asio::io_service io_service;
58 tcp::acceptor acceptor(io_service, tcp::endpoint(tcp::v6(), port));
61 acceptor.accept(socket);
64 boost::system::error_code ec;
65 socket.read_some(boost::asio::buffer(data), ec);
73 }
catch (std::exception & e) {
74 std::cout << e.what() << std::endl;
75 }
catch (boost::system::error_code & ec) {
76 std::cout << ec.message() << std::endl;
82 boost::asio::io_service ios;
84 boost::system::error_code ec;
86 BOOST_FAIL(
"Test timed out" );
109 typedef websocketpp::lib::shared_ptr<boost::asio::ssl::context>
context_ptr;
111 return context_ptr(
new boost::asio::ssl::context(boost::asio::ssl::context::sslv23));
118 mock_con(
bool a,
const websocketpp::lib::shared_ptr<config::alog_type>& b,
119 const websocketpp::lib::shared_ptr<config::elog_type>& c)
124 websocketpp::lib::placeholders::_1));
133 base::cancel_socket();
148 base::init_logging(alog,elog);
153 m_con.reset(
new mock_con(
false,alog,elog));
156 BOOST_CHECK( uri->get_valid() );
157 BOOST_CHECK_EQUAL(
base::init(m_con), websocketpp::lib::error_code() );
162 websocketpp::lib::bind(
166 websocketpp::lib::placeholders::_1
178 websocketpp::lib::shared_ptr<config::alog_type>
alog;
179 websocketpp::lib::shared_ptr<config::elog_type>
elog;
183 websocketpp::lib::thread dummy_server(websocketpp::lib::bind(&
run_dummy_server,9005));
184 websocketpp::lib::thread timer(websocketpp::lib::bind(&
run_test_timer,5000));
185 dummy_server.detach();
192 endpoint.
connect(
"wss://localhost:9005");
static level const all
Special aggregate value representing "all levels".
websocketpp::transport::asio::connection< config > con_type
static const bool enable_multithreading
Asio based endpoint transport component.
static const long timeout_socket_shutdown
lib::error_code make_error_code(error::value e)
websocketpp::lib::shared_ptr< config::elog_type > elog
void handle_connect(connection_ptr con, websocketpp::lib::error_code const &ec)
websocketpp::transport::asio::tls_socket::endpoint socket_type
websocketpp::http::parser::response response_type
lib::weak_ptr< void > connection_hdl
A handle to uniquely identify a connection.
websocketpp::http::parser::request request_type
Stores, parses, and manipulates HTTP responses.
void run_test_timer(long value)
void set_tls_init_handler(tls_init_handler h)
Set TLS init handler.
websocketpp::transport::asio::endpoint< config > base
websocketpp::log::stub alog_type
static const long timeout_connect
websocketpp::concurrency::none concurrency_type
static const long timeout_socket_pre_init
websocketpp::transport::asio::connection< config > base
mock_con(bool a, const websocketpp::lib::shared_ptr< config::alog_type > &b, const websocketpp::lib::shared_ptr< config::elog_type > &c)
static const long timeout_dns_resolve
Namespace for the WebSocket++ project.
void handle_start(const websocketpp::lib::error_code &ec)
websocketpp::lib::shared_ptr< mock_con > connection_ptr
Stub concurrency policy that implements the interface using no-ops.
static const long timeout_proxy
Asio based connection transport component.
void run_dummy_server(int port)
static const long timeout_socket_post_init
lib::shared_ptr< uri > uri_ptr
Pointer to a URI.
BOOST_AUTO_TEST_CASE(tls_handshake_timeout)
void connect(std::string u)
TLS enabled Asio endpoint socket component.
Stores, parses, and manipulates HTTP requests.
websocketpp::lib::shared_ptr< boost::asio::ssl::context > context_ptr
client::connection_ptr connection_ptr
std::size_t run()
wraps the run method of the internal io_service object
Catch-all error for socket component errors that don't fit in other categories.
websocketpp::lib::shared_ptr< boost::asio::ssl::context > context_ptr
Stub logger that ignores all input.
websocketpp::lib::shared_ptr< config::alog_type > alog
lib::error_code make_error_code(error::value e)
websocketpp::log::stub elog_type
context_ptr on_tls_init(websocketpp::connection_hdl)
boost::chrono::milliseconds milliseconds