summaryrefslogtreecommitdiffstats
path: root/tests/auto/networkselftest
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-10-06 18:47:52 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-10-06 18:47:52 (GMT)
commit9cf618492d1c89b489bf7e52e45c9577f9d52c1c (patch)
tree1684107174d2478aec50ea5eb62a90c4f414c260 /tests/auto/networkselftest
parenta2b8c2b6b5c7de30a3b0d390c3d9885aabb98c57 (diff)
downloadQt-9cf618492d1c89b489bf7e52e45c9577f9d52c1c.zip
Qt-9cf618492d1c89b489bf7e52e45c9577f9d52c1c.tar.gz
Qt-9cf618492d1c89b489bf7e52e45c9577f9d52c1c.tar.bz2
Autotest: use port 12346 instead of 1, to ensure that it's not a
firewall issue Also check if we're not timing out instead of being able to fail.
Diffstat (limited to 'tests/auto/networkselftest')
-rw-r--r--tests/auto/networkselftest/tst_networkselftest.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp
index c6a3119..e927a7a 100644
--- a/tests/auto/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/networkselftest/tst_networkselftest.cpp
@@ -335,10 +335,15 @@ void tst_NetworkSelfTest::dnsResolution()
void tst_NetworkSelfTest::serverReachability()
{
- // check that we get a proper error connecting to port 1
+ // check that we get a proper error connecting to port 12346
QTcpSocket socket;
- socket.connectToHost(QtNetworkSettings::serverName(), 1);
+ socket.connectToHost(QtNetworkSettings::serverName(), 12346);
+
+ QTime timer;
+ timer.start();
socket.waitForConnected(10000);
+ QVERIFY2(timer.elapsed() < 9900, "Connection to closed port timed out instead of refusing, something is wrong");
+
QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!");
QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError,
QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit());