diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2011-04-06 10:16:36 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2011-04-06 10:23:00 (GMT) |
commit | 397e139774eaaee88dc44cd47d296646ec03aed7 (patch) | |
tree | e8ab8d85a878e029b5cc55aba7f2ee75417d459d /tests/auto/qtcpserver | |
parent | 76ef8d709b7bb0458153df85f60b39937664811b (diff) | |
download | Qt-397e139774eaaee88dc44cd47d296646ec03aed7.zip Qt-397e139774eaaee88dc44cd47d296646ec03aed7.tar.gz Qt-397e139774eaaee88dc44cd47d296646ec03aed7.tar.bz2 |
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.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp index cff2fe5..9cddc00 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; |