88#include < boost/network/include/http/client.hpp>
99#include < boost/test/unit_test.hpp>
1010#include " client_types.hpp"
11+ #include " http_test_server.hpp"
1112
12- namespace http = boost::network::http;
13+ struct localhost_server_fixture {
14+ localhost_server_fixture () {
15+ if (!server.start ())
16+ std::cout <<" Failed to start HTTP server for test!" << std::endl;
17+ }
18+
19+ ~localhost_server_fixture () {
20+ if (!server.stop ())
21+ std::cout <<" Failed to stop HTTP server for test!" << std::endl;
22+ }
23+
24+ http_test_server server;
25+ };
26+
27+ BOOST_GLOBAL_FIXTURE (localhost_server_fixture);
1328
1429BOOST_AUTO_TEST_CASE_TEMPLATE (http_get_test_timeout_1_0, client, client_types) {
1530typename client::requestrequest (" http://localhost:12121/" );
@@ -22,11 +37,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout_1_0, client, client_types) {
2237 , std::exception);
2338}
2439
25- BOOST_AUTO_TEST_CASE_TEMPLATE (http_get_test_timeout_with_options, client,
26- client_types) {
27- typename client::requestrequest (
28- " http://cznic.dl.sourceforge.net/project/boost/boost/1.55.0/"
29- " boost_1_55_0.tar.bz2" );
40+ BOOST_AUTO_TEST_CASE_TEMPLATE (http_get_test_timeout_with_options, client, client_types) {
41+ typename client::requestrequest (" http://localhost:8000/cgi-bin/sleep.py?3" );
3042typename client::response response;
3143typename client::options options;
3244 clientclient_ (options.timeout (1 ));
@@ -37,10 +49,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout_with_options, client,
3749
3850#ifdef BOOST_NETWORK_ENABLE_HTTPS
3951
40- BOOST_AUTO_TEST_CASE_TEMPLATE (https_get_test_timeout_with_options, client,
41- client_types) {
42- typename client::requestrequest (
43- " https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.2.tar.bz2" );
52+ BOOST_AUTO_TEST_CASE_TEMPLATE (https_get_test_timeout_with_options, client, client_types) {
53+ typename client::requestrequest (" https://localhost:8000/cgi-bin/sleep.py?3" );
4454typename client::response response;
4555typename client::options options;
4656 clientclient_ (options.timeout (1 ));