summaryrefslogtreecommitdiffstats
path: root/tests/test_gsocket.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_gsocket.py')
-rw-r--r--tests/test_gsocket.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_gsocket.py b/tests/test_gsocket.py
index fd19cbb..bfc25f2 100644
--- a/tests/test_gsocket.py
+++ b/tests/test_gsocket.py
@@ -74,3 +74,27 @@ class TestSocketListener(unittest.TestCase):
socket, source = listener.accept_socket(cancellable=None)
self.failUnless(isinstance(socket, gio.Socket))
+
+ def test_socket_listener_accept_async(self):
+ def callback(listener, result):
+ try:
+ connection, source = listener.accept_finish(result)
+ self.failUnless(isinstance(connection, gio.TcpConnection))
+ finally:
+ loop.quit()
+
+ address = gio.inet_address_new_from_string("127.0.0.1")
+ inetsock = gio.InetSocketAddress(address, 1024)
+
+ listener = gio.SocketListener()
+ listener.add_address(inetsock,
+ gio.SOCKET_TYPE_STREAM,
+ gio.SOCKET_PROTOCOL_TCP)
+
+ client = gio.SocketClient()
+ client.connect_to_host("127.0.0.1:1024", 1024)
+
+ listener.accept_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()