diff options
Diffstat (limited to 'src/tests/unit_asio_stream.cpp')
-rw-r--r-- | src/tests/unit_asio_stream.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tests/unit_asio_stream.cpp b/src/tests/unit_asio_stream.cpp index 5621a9ddd..aa65b145f 100644 --- a/src/tests/unit_asio_stream.cpp +++ b/src/tests/unit_asio_stream.cpp @@ -558,6 +558,24 @@ class Asio_Stream_Tests final : public Test results.push_back(result); } + void test_sync_no_handshake(std::vector<Test::Result>& results) + { + net::io_context ioc; + TestStream remote{ioc}; + + auto ctx = get_context(); + Botan::TLS::Stream<TestStream> ssl(ctx, ioc); // Note that we're not using MockChannel here + ssl.next_layer().connect(remote); + error_code ec; + + net::write(ssl, net::const_buffer(TEST_DATA, TEST_DATA_SIZE), ec); + + Test::Result result("sync write_some without handshake fails gracefully"); + result.confirm("reports an error", ec.failed()); + + results.push_back(result); + } + void test_sync_write_some_buffer_sequence(std::vector<Test::Result>& results) { net::io_context ioc; @@ -755,6 +773,8 @@ class Asio_Stream_Tests final : public Test { std::vector<Test::Result> results; + test_sync_no_handshake(results); + test_sync_handshake(results); test_sync_handshake_error(results); test_sync_handshake_throw(results); |