@@ -89,24 +89,42 @@ TEST_FIXTURE(uri_address, auth_with_credentials, "Ignore", "245")
89
89
TEST (ssl_test)
90
90
{
91
91
websocket_client client;
92
- client.connect (U (" wss://echo.websocket.org/" )).wait ();
93
92
std::string body_str (" hello" );
94
93
95
- auto receive_task = client. receive (). then ([body_str](websocket_incoming_message ret_msg)
94
+ try
96
95
{
97
- auto ret_str = ret_msg. extract_string (). get ();
96
+ client. connect ( U ( " wss://echo.websocket.org/ " )). wait ();
98
97
99
- VERIFY_ARE_EQUAL (ret_msg.length (), body_str.length ());
100
- VERIFY_ARE_EQUAL (body_str.compare (ret_str), 0 );
101
- VERIFY_ARE_EQUAL (ret_msg.messge_type (), websocket_message_type::text_message);
102
- });
98
+ auto receive_task = client.receive ().then ([body_str](websocket_incoming_message ret_msg)
99
+ {
100
+ auto ret_str = ret_msg.extract_string ().get ();
103
101
104
- websocket_outgoing_message msg;
105
- msg.set_utf8_message (body_str);
106
- client.send (msg).wait ();
102
+ VERIFY_ARE_EQUAL (ret_msg.length (), body_str.length ());
103
+ VERIFY_ARE_EQUAL (body_str.compare (ret_str), 0 );
104
+ VERIFY_ARE_EQUAL (ret_msg.messge_type (), websocket_message_type::text_message);
105
+ });
107
106
108
- receive_task.wait ();
109
- client.close ().wait ();
107
+ websocket_outgoing_message msg;
108
+ msg.set_utf8_message (body_str);
109
+ client.send (msg).wait ();
110
+
111
+ receive_task.wait ();
112
+ client.close ().wait ();
113
+ }
114
+ catch (const websocket_exception &e)
115
+ {
116
+ const auto msg = std::string (e.what ());
117
+ if (msg.find (" set_fail_handler" ) != std::string::npos)
118
+ {
119
+ if (msg.find (" TLS handshake timed out" ) != std::string::npos || msg.find (" Timer Expired" ) != std::string::npos)
120
+ {
121
+ // Since this test depends on an outside server sometimes it sporadically can fail due to timeouts
122
+ // especially on our build machines.
123
+ return ;
124
+ }
125
+ }
126
+ throw ;
127
+ }
110
128
}
111
129
112
130
// These tests are specific to our websocketpp based implementation.
0 commit comments