diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2018-08-10 10:43:00 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2018-08-10 12:18:41 +0000 |
commit | 8f58e1319c064fbdf5ec00a2b261c9d8069c6cfb (patch) | |
tree | 11acaf2a6ff271c915ea13b1f95cd6e3188875c7 /tests | |
parent | 468c3717ebc20e159c0d48aad94411841feb551c (diff) |
tst_qdtls: add 'invalidConfiguration' test
Test that we don't silently replace an invalid TLS configuration with
the default one (for now, the only thing that is considered to be
non-valid - is having non-DTLS protocol set).
Change-Id: I6f714b009cf1345a085a3f26d638fc31330f1a94
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/network/ssl/qdtls/tst_qdtls.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/network/ssl/qdtls/tst_qdtls.cpp b/tests/auto/network/ssl/qdtls/tst_qdtls.cpp index 6ca4ca9b92..6a94eee389 100644 --- a/tests/auto/network/ssl/qdtls/tst_qdtls.cpp +++ b/tests/auto/network/ssl/qdtls/tst_qdtls.cpp @@ -88,6 +88,7 @@ private slots: void construction(); void configuration_data(); void configuration(); + void invalidConfiguration(); void setPeer_data(); void setPeer(); void handshake_data(); @@ -310,6 +311,20 @@ void tst_QDtls::configuration() } } +void tst_QDtls::invalidConfiguration() +{ + QUdpSocket socket; + QDtls crypto(QSslSocket::SslClientMode); + QVERIFY(crypto.setPeer(serverAddress, serverPort)); + // Note: not defaultDtlsConfiguration(), so the protocol is TLS (without D): + QVERIFY(crypto.setDtlsConfiguration(QSslConfiguration::defaultConfiguration())); + QDTLS_VERIFY_NO_ERROR(crypto); + QCOMPARE(crypto.dtlsConfiguration(), QSslConfiguration::defaultConfiguration()); + // Try to start the handshake: + QCOMPARE(crypto.doHandshake(&socket), false); + QCOMPARE(crypto.dtlsError(), QDtlsError::TlsInitializationError); +} + void tst_QDtls::setPeer_data() { clientServerData(); |