Branch data Line data Source code
# 1 : : // Copyright (c) 2021-2021 The Bitcoin Core developers # 2 : : // Distributed under the MIT software license, see the accompanying # 3 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php. # 4 : : # 5 : : #include <i2p.h> # 6 : : #include <netaddress.h> # 7 : : #include <test/util/logging.h> # 8 : : #include <test/util/net.h> # 9 : : #include <test/util/setup_common.h> # 10 : : #include <threadinterrupt.h> # 11 : : #include <util/system.h> # 12 : : # 13 : : #include <boost/test/unit_test.hpp> # 14 : : # 15 : : #include <memory> # 16 : : #include <string> # 17 : : # 18 : : BOOST_FIXTURE_TEST_SUITE(i2p_tests, BasicTestingSetup) # 19 : : # 20 : : BOOST_AUTO_TEST_CASE(unlimited_recv) # 21 : 2 : { # 22 : 2 : auto CreateSockOrig = CreateSock; # 23 : : # 24 : : // Mock CreateSock() to create MockSock. # 25 : 2 : CreateSock = [](const CService&) { # 26 : 2 : return std::make_unique<StaticContentsSock>(std::string(i2p::sam::MAX_MSG_SIZE + 1, 'a')); # 27 : 2 : }; # 28 : : # 29 : 2 : CThreadInterrupt interrupt; # 30 : 2 : i2p::sam::Session session(gArgs.GetDataDirNet() / "test_i2p_private_key", CService{}, &interrupt); # 31 : : # 32 : 2 : { # 33 : 2 : ASSERT_DEBUG_LOG("Creating SAM session"); # 34 : 2 : ASSERT_DEBUG_LOG("too many bytes without a terminator"); # 35 : : # 36 : 2 : i2p::Connection conn; # 37 : 2 : bool proxy_error; # 38 : 2 : BOOST_REQUIRE(!session.Connect(CService{}, conn, proxy_error)); # 39 : 2 : } # 40 : : # 41 : 2 : CreateSock = CreateSockOrig; # 42 : 2 : } # 43 : : # 44 : : BOOST_AUTO_TEST_SUITE_END()