Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Test timeout in client

  • Loading branch information...
commit e2a8a6b4fe96a9c1bf78d2fb64dac65ce697b37f 1 parent af365dd
Tadeas Moravec authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 tests/test_client.py
View
13 tests/test_client.py
@@ -7,6 +7,7 @@
from twisted.web.server import Site
from twisted.internet import reactor
from twisted.web.client import Agent
+from twisted.internet.error import TimeoutError
from fastjsonrpc.client import ReceiverProtocol
from fastjsonrpc.client import StringProducer
@@ -247,3 +248,15 @@ def finished(result):
e.addCallback(finished)
return d
+
+ def test_timeout(self):
+ """ Google doesn't offer any services on our crazy ports """
+ addr = 'http://google.com:%s' % self.portNumber
+ proxy = Proxy(addr, jsonrpc.VERSION_1, connectTimeout=0.1)
+ d = proxy.callRemote('sleep', 5)
+
+ def finished(result):
+ self.assertTrue(isinstance(result.value, TimeoutError))
+
+ d.addErrback(finished)
+ return d
Please sign in to comment.
Something went wrong with that request. Please try again.