summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtcpserver
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2011-04-06 12:16:36 +0200
committerMarkus Goetz <Markus.Goetz@nokia.com>2011-04-06 12:23:00 +0200
commit397e139774eaaee88dc44cd47d296646ec03aed7 (patch)
treee8ab8d85a878e029b5cc55aba7f2ee75417d459d /tests/auto/qtcpserver
parent76ef8d709b7bb0458153df85f60b39937664811b (diff)
tst_qtcpserver: Add a mapped v4 addr test
Reviewed-by: Shane Kearns
Diffstat (limited to 'tests/auto/qtcpserver')
-rw-r--r--tests/auto/qtcpserver/tst_qtcpserver.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp
index cff2fe5d55..9cddc00059 100644
--- a/tests/auto/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp
@@ -97,6 +97,7 @@ private slots:
void constructing();
void clientServerLoop();
void ipv6Server();
+ void ipv6ServerMapped();
void crashTests();
void maxPendingConnections();
void listenError();
@@ -265,6 +266,40 @@ void tst_QTcpServer::ipv6Server()
}
//----------------------------------------------------------------------------------
+void tst_QTcpServer::ipv6ServerMapped()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ QTcpServer server;
+ QVERIFY(server.listen(QHostAddress::LocalHost));
+
+ // let's try the normal case
+ QTcpSocket client1;
+ client1.connectToHost("127.0.0.1", server.serverPort());
+ QVERIFY(server.waitForNewConnection(5000));
+ delete server.nextPendingConnection();
+
+ // let's try the mapped one in the nice format
+ QTcpSocket client2;
+ client2.connectToHost("::ffff:127.0.0.1", server.serverPort());
+ QVERIFY(server.waitForNewConnection(5000));
+ delete server.nextPendingConnection();
+
+ // let's try the mapped in hex format
+ QTcpSocket client3;
+ client3.connectToHost("::ffff:7F00:0001", server.serverPort());
+ QVERIFY(server.waitForNewConnection(5000));
+ delete server.nextPendingConnection();
+
+ // However connecting to the v6 localhost should not work
+ QTcpSocket client4;
+ client4.connectToHost("::1", server.serverPort());
+ QVERIFY(!server.waitForNewConnection(5000));
+}
+
+//----------------------------------------------------------------------------------
void tst_QTcpServer::crashTests()
{
QTcpServer server;