tests/auto/qhttp/tst_qhttp.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
--- a/tests/auto/qhttp/tst_qhttp.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/tests/auto/qhttp/tst_qhttp.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -114,9 +114,6 @@
     void abortInReadyRead();
     void abortInResponseHeaderReceived();
     void nestedEventLoop();
-
-
-    // manual tests
     void connectionClose();
 
 protected slots:
@@ -175,6 +172,23 @@
     bool proxyAuthCalled;
 };
 
+class ClosingServer: public QTcpServer
+{
+    Q_OBJECT
+public:
+    ClosingServer()
+    {
+        connect(this, SIGNAL(newConnection()), SLOT(handleConnection()));
+        listen();
+    }
+
+public slots:
+    void handleConnection()
+    {
+        delete nextPendingConnection();
+    }
+};
+
 //#define DUMP_SIGNALS
 
 const int bytesTotal_init = -10;
@@ -1491,20 +1505,14 @@
 
 void tst_QHttp::connectionClose()
 {
-    // This test tries to connect to a client's server, so it is disabled.
-    // Every now and then, someone please run it to make sure it's not broken.
-    // Note: the servers might change too...
-    //
     // This was added in response to bug 176822
-#ifndef Q_OS_SYMBIAN
-    QSKIP("This test is manual - read comments in the source code", SkipAll);
-#endif
     QFETCH_GLOBAL(bool, setProxy);
     if (setProxy)
         return;
 
     QHttp http;
-    http.setHost("www.fon.com", QHttp::ConnectionModeHttps);
+    ClosingServer server;
+    http.setHost("localhost", QHttp::ConnectionModeHttps, server.serverPort());
     http.get("/login/gateway/processLogin");
 
     // another possibility: