diff --git a/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp b/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp index f8e48f7d9..7f0508cc0 100644 --- a/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp +++ b/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp @@ -38,6 +38,7 @@ #include #include #include +#include using namespace Poco::Net; @@ -306,22 +307,27 @@ void HTTPSClientSessionTest::testInterop() void HTTPSClientSessionTest::testProxy() { - HTTPSTestServer srv; - HTTPSClientSession s("secure.appinf.com"); - s.setProxy( - Application::instance().config().getString("testsuite.proxy.host"), - Application::instance().config().getInt("testsuite.proxy.port") - ); - HTTPRequest request(HTTPRequest::HTTP_GET, "/public/poco/NetSSL.txt"); - s.sendRequest(request); - X509Certificate cert = s.serverCertificate(); - HTTPResponse response; - std::istream& rs = s.receiveResponse(response); - std::ostringstream ostr; - StreamCopier::copyStream(rs, ostr); - std::string str(ostr.str()); - assert (str == "This is a test file for NetSSL.\n"); - assert (cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com"); + try { + HTTPSTestServer srv; + HTTPSClientSession s("secure.appinf.com"); + s.setProxy( + Application::instance().config().getString("testsuite.proxy.host"), + Application::instance().config().getInt("testsuite.proxy.port") + ); + HTTPRequest request(HTTPRequest::HTTP_GET, "/public/poco/NetSSL.txt"); + s.sendRequest(request); + X509Certificate cert = s.serverCertificate(); + HTTPResponse response; + std::istream& rs = s.receiveResponse(response); + std::ostringstream ostr; + StreamCopier::copyStream(rs, ostr); + std::string str(ostr.str()); + assert(str == "This is a test file for NetSSL.\n"); + assert(cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com"); + } + catch (Poco::Net::HTTPException e) { + std::cout << e.displayText() << std::endl; + } } @@ -477,8 +483,8 @@ CppUnit::Test* HTTPSClientSessionTest::suite() should use a public proxy server http://www.publicproxyservers.com/proxy/list1.html Really working public proxy servers - page 1 of 6. - CppUnit_addTest(pSuite, HTTPSClientSessionTest, testProxy); #endif + CppUnit_addTest(pSuite, HTTPSClientSessionTest, testProxy); CppUnit_addTest(pSuite, HTTPSClientSessionTest, testCachedSession); CppUnit_addTest(pSuite, HTTPSClientSessionTest, testUnknownContentLength); CppUnit_addTest(pSuite, HTTPSClientSessionTest, testServerAbort);