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));
122 websocketpp::lib::placeholders::_1));
131 base::cancel_socket();
143 base::init_logging(&alog,&elog);
148 m_con.reset(
new mock_con(
false,alog,elog));
151 BOOST_CHECK( uri->get_valid() );
152 BOOST_CHECK_EQUAL(
base::init(m_con), websocketpp::lib::error_code() );
157 websocketpp::lib::bind(
161 websocketpp::lib::placeholders::_1
178 websocketpp::lib::thread dummy_server(websocketpp::lib::bind(&
run_dummy_server,9005));
179 websocketpp::lib::thread timer(websocketpp::lib::bind(&
run_test_timer,5000));
180 dummy_server.detach();
185 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)
void handle_connect(connection_ptr con, websocketpp::lib::error_code const &ec)
boost::posix_time::time_duration milliseconds(long duration)
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
mock_con(bool a, config::alog_type &b, config::elog_type &c)
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
static const long timeout_dns_resolve
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.
lib::error_code make_error_code(error::value e)
websocketpp::log::stub elog_type
context_ptr on_tls_init(websocketpp::connection_hdl)