1 /*
2     Copyright (c) 2010-2012 250bpm s.r.o.
3     Copyright (c) 2011 iMatix Corporation
4     Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
5 
6     This file is part of Crossroads I/O project.
7 
8     Crossroads I/O is free software; you can redistribute it and/or modify it
9     under the terms of the GNU Lesser General Public License as published by
10     the Free Software Foundation; either version 3 of the License, or
11     (at your option) any later version.
12 
13     Crossroads is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU Lesser General Public License for more details.
17 
18     You should have received a copy of the GNU Lesser General Public License
19     along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include "testutil.hpp"
23 
XS_TEST_MAIN()24 int XS_TEST_MAIN ()
25 {
26     fprintf (stderr, "reqrep_tcp test running...\n");
27 
28     void *ctx = xs_init ();
29     assert (ctx);
30 
31     void *sb = xs_socket (ctx, XS_REP);
32     assert (sb);
33     int rc = xs_bind (sb, "tcp://127.0.0.1:5560");
34     assert (rc != -1);
35 
36     void *sc = xs_socket (ctx, XS_REQ);
37     assert (sc);
38     rc = xs_connect (sc, "tcp://127.0.0.1:5560");
39     assert (rc != -1);
40 
41     bounce (sb, sc);
42 
43     rc = xs_close (sc);
44     assert (rc == 0);
45 
46     rc = xs_close (sb);
47     assert (rc == 0);
48 
49     rc = xs_term (ctx);
50     assert (rc == 0);
51 
52     return 0 ;
53 }
54