示例#1
0
def callTestLocal(url):
    srv = TestServer()
    srv.setDaemon(True)
    srv.start()
    # Due to some reason server does not accept connections right after it's started.
    sleep(0.5) 
    
    proxy = HessianProxy(url)
        
    msg = proxy.nothing()
    assert None == msg
      
    msg = proxy.hello()
    assert SECRET_MESSAGE == msg
    
    try:
        proxy.askBitchy()
        assert False # should not get here
    except Exception as e:
        assert "Go away!" == e.testMessage 
    
    # What about UTF-8?
    padonkMessage = u"Пррревед обонентеги!"
    assert padonkMessage == proxy.echo(padonkMessage)
    
    callBlobTest(proxy)
    redirectTest(proxy)
    
    if True:
        from time import time 
        print "Some performance measurements..."
        count = 1000
        start = time()
        for _ in range(count):
            proxy.hello()
        fin = time()
        print "One call takes", 1000.0 * (fin - start) / count, "mSec."        

    srv.stop()
示例#2
0
def callTestLocal(url):
    srv = TestServer()
    srv.setDaemon(True)
    srv.start()
    # Due to some reason server does not accept connections right after it's started.
    sleep(0.5)

    proxy = HessianProxy(url)

    msg = proxy.nothing()
    assert None == msg

    msg = proxy.hello()
    assert SECRET_MESSAGE == msg

    try:
        proxy.askBitchy()
        assert False  # should not get here
    except Exception as e:
        assert "Go away!" == e.testMessage

    # What about UTF-8?
    padonkMessage = u"Пррревед обонентеги!"
    assert padonkMessage == proxy.echo(padonkMessage)

    callBlobTest(proxy)
    redirectTest(proxy)

    if True:
        from time import time
        print "Some performance measurements..."
        count = 1000
        start = time()
        for _ in range(count):
            proxy.hello()
        fin = time()
        print "One call takes", 1000.0 * (fin - start) / count, "mSec."

    srv.stop()