summaryrefslogtreecommitdiff
path: root/auto_tests/invalid_proxy_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/invalid_proxy_test.c')
-rw-r--r--auto_tests/invalid_proxy_test.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/auto_tests/invalid_proxy_test.c b/auto_tests/invalid_proxy_test.c
deleted file mode 100644
index 3e729b5a..00000000
--- a/auto_tests/invalid_proxy_test.c
+++ /dev/null
@@ -1,51 +0,0 @@
1// Test that if UDP is enabled, and a proxy is provided that does not support
2// UDP proxying, we disable UDP.
3
4#ifdef HAVE_CONFIG_H
5#include "config.h"
6#endif
7
8#include <stdio.h>
9
10#include "../testing/misc_tools.h"
11#include "check_compat.h"
12
13static uint8_t const key[] = {
14 0x15, 0xE9, 0xC3, 0x09, 0xCF, 0xCB, 0x79, 0xFD,
15 0xDF, 0x0E, 0xBA, 0x05, 0x7D, 0xAB, 0xB4, 0x9F,
16 0xE1, 0x5F, 0x38, 0x03, 0xB1, 0xBF, 0xF0, 0x65,
17 0x36, 0xAE, 0x2E, 0x5B, 0xA5, 0xE4, 0x69, 0x0E,
18};
19
20// Try to bootstrap for 30 seconds.
21#define NUM_ITERATIONS (unsigned)(30.0 / (ITERATION_INTERVAL / 1000.0))
22
23int main(void)
24{
25 setvbuf(stdout, nullptr, _IONBF, 0);
26
27 struct Tox_Options *opts = tox_options_new(nullptr);
28 tox_options_set_udp_enabled(opts, true);
29 tox_options_set_proxy_type(opts, TOX_PROXY_TYPE_SOCKS5);
30 tox_options_set_proxy_host(opts, "localhost");
31 tox_options_set_proxy_port(opts, 51724);
32 Tox *tox = tox_new_log(opts, nullptr, nullptr);
33 tox_options_free(opts);
34
35 tox_add_tcp_relay(tox, "tox.ngc.zone", 33445, key, nullptr);
36 tox_bootstrap(tox, "tox.ngc.zone", 33445, key, nullptr);
37
38 printf("Waiting for connection");
39
40 for (unsigned i = 0; i < NUM_ITERATIONS; i++) {
41 tox_iterate(tox, nullptr);
42 c_sleep(ITERATION_INTERVAL);
43 // None of the iterations should have a connection.
44 const TOX_CONNECTION status = tox_self_get_connection_status(tox);
45 ck_assert_msg(status == TOX_CONNECTION_NONE,
46 "unexpectedly got a connection (%d)", status);
47 }
48
49 tox_kill(tox);
50 return 0;
51}