summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGian Mario Tagliaretti <gianmt@gnome.org>2010-01-01 12:41:08 +0100
committerGian Mario Tagliaretti <gianmt@gnome.org>2010-01-01 12:41:08 +0100
commitb8c7e996498bd72df551011af85ff05ef7335b4f (patch)
tree70bacda5942caf7aac27fb24cb742d0714468861 /tests
parenta5ae2d5ba3db34967fe07a3cc97b75df2793988c (diff)
downloadpygobject-b8c7e996498bd72df551011af85ff05ef7335b4f.tar.gz
pygobject-b8c7e996498bd72df551011af85ff05ef7335b4f.tar.xz
pygobject-b8c7e996498bd72df551011af85ff05ef7335b4f.zip
Wrap gio.SocketListener.accept_socket_async|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 bfc25f2..16ff40f 100644
--- a/tests/test_gsocket.py
+++ b/tests/test_gsocket.py
@@ -98,3 +98,27 @@ class TestSocketListener(unittest.TestCase):
loop = glib.MainLoop()
loop.run()
+
+ def test_socket_listener_accept_socket_async(self):
+ def callback(listener, result):
+ try:
+ socket, source = listener.accept_socket_finish(result)
+ self.failUnless(isinstance(socket, gio.Socket))
+ 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_socket_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()