simulation/test_socks5.cpp
// make sure a listen_succeeded_alert is issued when successfully listening on
// incoming connections via a socks5 proxy
make sure a listen_succeeded_alert is issued when successfully listening on
incoming connections via a socks5 proxy
make sure a listen_succeeded_alert is issued when successfully listening on incoming connections via a socks5 proxy
TORRENT_TEST(socks4_tcp_listen_alert)
{
	using namespace libtorrent;
	bool listen_alert = false;
	run_test(
		[](lt::session& ses)
		{
			set_proxy(ses, settings_pack::socks4);
		},
		[&](lt::session& ses, lt::alert const* alert) {
			if (auto* a = lt::alert_cast<lt::listen_succeeded_alert>(alert))
			{
				if (a->sock_type == listen_succeeded_alert::socks5)
				{
					TEST_EQUAL(a->endpoint.address(), addr("50.50.50.50"));
					TEST_EQUAL(a->endpoint.port(), 6881);
					listen_alert = true;
				}
			}
		},
		[](sim::simulation& sim, lt::session& ses
			, boost::shared_ptr<lt::torrent_info> ti)
		{
			sim.run();
		}
	);
	TEST_EQUAL(listen_alert, true);
}
TORRENT_TEST ( socks4_tcp_listen_alert ) { using namespace libtorrent ; bool listen_alert = false ; run_test ( [ ] ( lt :: session & ses ) { set_proxy ( ses , settings_pack :: socks4 ) ; } , [ & ] ( lt :: session & ses , lt :: alert const * alert ) { if ( auto * a = lt :: alert_cast < lt :: listen_succeeded_alert > ( alert ) ) { if ( a -> sock_type == listen_succeeded_alert :: socks5 ) { TEST_EQUAL ( a -> endpoint . address ( ) , addr ( " " ) ) ; TEST_EQUAL ( a -> endpoint . port ( ) , 6881 ) ; listen_alert = true ; } } } , [ ] ( sim :: simulation & sim , lt :: session & ses , boost :: shared_ptr < lt :: torrent_info > ti ) { sim . run ( ) ; } ) ; TEST_EQUAL ( listen_alert , true ) ; }
make sure a listen_succeeded_alert is issued when successfully listening on
incoming connections via a socks5 proxy
make sure a listen_succeeded_alert is issued when successfully listening on incoming connections via a socks5 proxy