def connected( protocol ): self.tcp_proxy_proto = protocol text = "TCP Test" request = EchoRequest() request.text = text proxy = tx.Proxy( Test_Stub( protocol ) ) echoed = proxy.Test.Echo( request ) echoed.addCallback( lambda r: self.assertEquals( r.text, text ) ) return echoed
def testUdpRpc( self ): protocol = tx.UdpChannel( self.udp_listener.getHost().host, self.udp_listener.getHost().port ) proxy = tx.Proxy( Test_Stub( protocol ) ) self.udp_proxy_port = reactor.listenUDP( 0, protocol ) text = "UDP Test" request = EchoRequest() request.text = text echoed = proxy.Test.Echo( request ) echoed.addCallback( lambda r: self.assertEquals( r.text, text ) ) return echoed