summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGian Mario Tagliaretti <gianmt@gnome.org>2010-01-01 12:28:53 +0100
committerGian Mario Tagliaretti <gianmt@gnome.org>2010-01-01 12:28:53 +0100
commita5ae2d5ba3db34967fe07a3cc97b75df2793988c (patch)
tree0b5eddbbbccd57adef4ff078b3663a7c5c3f37c5 /tests
parenta5ab26cc1bb3e9dd57e2fdb26ef5c02e8066d097 (diff)
downloadpygobject-a5ae2d5ba3db34967fe07a3cc97b75df2793988c.tar.gz
pygobject-a5ae2d5ba3db34967fe07a3cc97b75df2793988c.tar.xz
pygobject-a5ae2d5ba3db34967fe07a3cc97b75df2793988c.zip
Wrap gio.SocketListener.accept_finish() and add a test
Diffstat (limited to 'tests')
-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()