Example #1
0
    def on_close(e):
        twitter.disconnect()

        import AsyncoreThread
        AsyncoreThread.join()

        f.Destroy()
Example #2
0
def main():
    fix_logging()
    AsyncoreThread.start()
    import wx; a = testapp('../../..')

    a.toggle_crust()

    from jabber import protocol
    global jabber
    jargs, jkwargs = connection_settings['gtalk']
    jabber = protocol(*jargs, **jkwargs)
    jabber.Connect()

    a.MainLoop()
    try:
        jabber.Disconnect()
    except:
        pass

    AsyncoreThread.join(timeout = None)
Example #3
0
def main():
    fix_logging()
    AsyncoreThread.start()
    import wx
    a = testapp('../../..')

    a.toggle_crust()

    from jabber import protocol
    global jabber
    jargs, jkwargs = connection_settings['gtalk']
    jabber = protocol(*jargs, **jkwargs)
    jabber.Connect()

    a.MainLoop()
    try:
        jabber.Disconnect()
    except:
        pass

    AsyncoreThread.join(timeout=None)
Example #4
0
    AT.start()

    srv = HTTPServerManager()

    class ClosingHandler(DefaultHandler):
        def handle(self, client, request):
            print "closing!"
            client.push("HTTP/1.1 200 OK\r\n" "Connection: close\r\n" "\r\n" "server has been shutdown")
            client.close()
            srv.shutdown()

    host, port = srv.serve("/close", ClosingHandler, host="", port=0)
    srv.serve(lambda *a: True, DefaultHandler, host="", port=0)

    print AT.net_thread.map
    import time

    time.sleep(1)
    import urllib2

    try:
        for url in ("http://localhost:{port}/foo/bar", "http://localhost:{port}/close", "http://localhost:{port}/blah"):
            x = urllib2.urlopen(url.format(**locals()))
            print x.read()
            x.close()
    except Exception, e:
        print "urlopenerror:", e
    time.sleep(1)
    AT.join()
Example #5
0
    class ClosingHandler(DefaultHandler):
        def handle(self, client, request):
            print 'closing!'
            client.push('HTTP/1.1 200 OK\r\n'
                        'Connection: close\r\n'
                        '\r\n'
                        'server has been shutdown')
            client.close()
            srv.shutdown()

    host, port = srv.serve('/close', ClosingHandler, host='', port=0)
    srv.serve(lambda *a: True, DefaultHandler, host='', port=0)

    print AT.net_thread.map
    import time
    time.sleep(1)
    import urllib2
    try:
        for url in (
                'http://localhost:{port}/foo/bar',
                'http://localhost:{port}/close',
                'http://localhost:{port}/blah',
        ):
            x = urllib2.urlopen(url.format(**locals()))
            print x.read()
            x.close()
    except Exception, e:
        print 'urlopenerror:', e
    time.sleep(1)
    AT.join()