@@ -14,7 +14,7 @@ namespace util = boost::network::utils;
14
14
15
15
struct dummy_sync_handler ;
16
16
struct dummy_async_handler ;
17
- typedef http::server <dummy_sync_handler> sync_server;
17
+ typedef http::sync_server <dummy_sync_handler> sync_server;
18
18
typedef http::async_server<dummy_async_handler> async_server;
19
19
20
20
struct dummy_sync_handler {
@@ -38,47 +38,45 @@ BOOST_AUTO_TEST_CASE(minimal_constructor) {
38
38
dummy_sync_handler sync_handler;
39
39
dummy_async_handler async_handler;
40
40
util::thread_pool pool;
41
+ http::server_options options;
42
+ options.address (" 127.0.0.1" )
43
+ .port (" 80" );
41
44
42
- BOOST_CHECK_NO_THROW (sync_server sync_instance (" 127.0.0.1 " , " 80 " , sync_handler) );
43
- BOOST_CHECK_NO_THROW (async_server async_instance (" 127.0.0.1 " , " 80 " , async_handler, pool) );
45
+ BOOST_CHECK_NO_THROW (sync_server sync_instance (options , sync_handler) );
46
+ BOOST_CHECK_NO_THROW (async_server async_instance (options , async_handler, pool) );
44
47
}
45
48
46
49
BOOST_AUTO_TEST_CASE (with_io_service_parameter) {
47
50
dummy_sync_handler sync_handler;
48
51
dummy_async_handler async_handler;
49
52
util::thread_pool pool;
50
53
boost::asio::io_service io_service;
54
+ http::server_options options;
55
+ options.address (" 127.0.0.1" )
56
+ .port (" 80" )
57
+ .io_service (&io_service);
51
58
52
- BOOST_CHECK_NO_THROW (sync_server sync_instance (" 127.0.0.1 " , " 80 " , sync_handler, io_service ));
53
- BOOST_CHECK_NO_THROW (async_server async_instance (" 127.0.0.1 " , " 80 " , async_handler, pool, io_service ));
59
+ BOOST_CHECK_NO_THROW (sync_server sync_instance (options, sync_handler));
60
+ BOOST_CHECK_NO_THROW (async_server async_instance (options, async_handler, pool));
54
61
}
55
62
56
63
BOOST_AUTO_TEST_CASE (with_socket_options_parameter) {
57
64
dummy_sync_handler sync_handler;
58
65
dummy_async_handler async_handler;
59
66
util::thread_pool pool;
67
+ http::server_options options;
68
+ options.address (" 127.0.0.1" )
69
+ .port (" 80" )
70
+ .reuse_address (true )
71
+ .report_aborted (true )
72
+ .receive_buffer_size (4096 )
73
+ .send_buffer_size (4096 )
74
+ .receive_low_watermark (1024 )
75
+ .send_low_watermark (1024 )
76
+ .non_blocking_io (true )
77
+ .linger (true )
78
+ .linger_timeout (0 );
60
79
61
- BOOST_CHECK_NO_THROW (sync_server sync_instance (" 127.0.0.1" , " 80" , sync_handler,
62
- http::_reuse_address=true ,
63
- http::_report_aborted=true ,
64
- http::_receive_buffer_size=4096 ,
65
- http::_send_buffer_size=4096 ,
66
- http::_receive_low_watermark=1024 ,
67
- http::_send_low_watermark=1024 ,
68
- http::_non_blocking_io=true ,
69
- http::_linger=true ,
70
- http::_linger_timeout=0
71
- ));
72
- BOOST_CHECK_NO_THROW (async_server async_instance (" 127.0.0.1" , " 80" , async_handler, pool,
73
- http::_reuse_address=true ,
74
- http::_report_aborted=true ,
75
- http::_receive_buffer_size=4096 ,
76
- http::_send_buffer_size=4096 ,
77
- http::_receive_low_watermark=1024 ,
78
- http::_send_low_watermark=1024 ,
79
- http::_non_blocking_io=true ,
80
- http::_linger=true ,
81
- http::_linger_timeout=0
82
- ));
83
-
80
+ BOOST_CHECK_NO_THROW (sync_server sync_instance (options, sync_handler));
81
+ BOOST_CHECK_NO_THROW (async_server async_instance (options, async_handler, pool));
84
82
}
0 commit comments