示例#1
0
def test1():
    """Test the SocketTalk peers."""
    from SocketTalk import SocketTalk
    talk1, talk2 = SocketTalk.pair()
    talk1.put('one')
    assert talk2.get() == 'one'
    talk2.put('two')
    assert talk1.get() == 'two'
    talk2.close()
    assert talk1.get() is None
    talk1.close()
示例#2
0
 def server():
     talk = SocketTalk.server(addr)
     assert talk.get() == 'one'
     talk.put('two')
     talk.close()
示例#3
0
 def client():
     talk = SocketTalk.client(addr)
     talk.put('one')
     assert talk.get() == 'two'
     talk.close()