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