summaryrefslogtreecommitdiff
path: root/tests/tcp.c
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2013-10-31 13:36:25 +0100
committerMartin Sustrik <sustrik@250bpm.com>2013-10-31 13:36:25 +0100
commit25b6c37f8ff90f584fff112240d9c3bc0ce8a1a5 (patch)
tree96b82f50a6c0e42fb4409afad03fcba9d6bf58c7 /tests/tcp.c
parent14b9ef53ea8f71258b0eb3ba3d4a5aca482d1691 (diff)
downloadnanomsg-25b6c37f8ff90f584fff112240d9c3bc0ce8a1a5.tar.gz
tests for rejected connections added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'tests/tcp.c')
-rw-r--r--tests/tcp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/tcp.c b/tests/tcp.c
index 9e1c0bb..0f4a9ca 100644
--- a/tests/tcp.c
+++ b/tests/tcp.c
@@ -39,6 +39,7 @@ int main ()
int i;
int opt;
size_t sz;
+ int s1, s2;
/* Try closing bound but unconnected socket. */
sb = test_socket (AF_SP, NN_PAIR);
@@ -148,6 +149,18 @@ int main ()
test_close (sc);
test_close (sb);
+ /* Test whether connection rejection is handled decently. */
+ sb = test_socket (AF_SP, NN_PAIR);
+ test_bind (sb, SOCKET_ADDRESS);
+ s1 = test_socket (AF_SP, NN_PAIR);
+ test_connect (s1, SOCKET_ADDRESS);
+ s2 = test_socket (AF_SP, NN_PAIR);
+ test_connect (s2, SOCKET_ADDRESS);
+ nn_sleep (100);
+ test_close (s2);
+ test_close (s1);
+ test_close (sb);
+
return 0;
}