• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/boostorg/beast
8 //
9 
10 // VFALCO This causes a compilation error
11 #include <boost/beast/websocket/stream.hpp>
12 
13 // Test that header file is self-contained.
14 #include <boost/beast/websocket/ssl.hpp>
15 
16 #include <boost/beast/websocket/stream.hpp>
17 #include <boost/beast/_experimental/unit_test/suite.hpp>
18 #include <boost/asio/executor.hpp>
19 #include <boost/asio/ip/tcp.hpp>
20 #include <boost/asio/ssl.hpp>
21 
22 namespace boost {
23 namespace beast {
24 namespace websocket {
25 
26 class ssl_test : public unit_test::suite
27 {
28 public:
29     template<class Socket>
30     void
testTeardown()31     testTeardown()
32     {
33         net::io_context ioc;
34         net::ssl::context ctx(net::ssl::context::tlsv12);
35         Socket ss(ioc, ctx);
36 
37         struct handler
38         {
39             void
40             operator()(error_code)
41             {
42             }
43         };
44 
45         websocket::stream<Socket> ws(ioc, ctx);
46 
47         BEAST_EXPECT(static_cast<
48             void(websocket::stream<Socket>::*)(
49                 close_reason const&)>(
50             &websocket::stream<Socket>::close));
51 
52         BEAST_EXPECT(static_cast<
53             void(websocket::stream<Socket>::*)(
54                 close_reason const&, error_code&)>(
55             &websocket::stream<Socket>::close));
56     }
57 
58     void
run()59     run() override
60     {
61         testTeardown<
62             boost::asio::ssl::stream<
63                 boost::asio::basic_stream_socket<
64                     boost::asio::ip::tcp,
65                     net::any_io_executor>>>();
66 
67     }
68 };
69 
70 BEAST_DEFINE_TESTSUITE(beast,websocket,ssl);
71 
72 } // websocket
73 } // beast
74 } // boost
75