aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_server.py')
-rw-r--r--test/test_server.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_server.py b/test/test_server.py
index a2c65275..9df88400 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -1,4 +1,5 @@
import socket, time
+import mock
from netlib import tcp
from libpathod import pathoc
import tutils, tservers
@@ -97,6 +98,14 @@ class TestHTTP(tservers.HTTPProxTest, SanityMixin):
assert p.request("get:'%s':h'Connection'='close'"%response)
tutils.raises("disconnect", p.request, "get:'%s'"%response)
+ def test_proxy_ioerror(self):
+ # Tests a difficult-to-trigger condition, where an IOError is raised
+ # within our read loop.
+ with mock.patch("libmproxy.proxy.ProxyHandler.read_request") as m:
+ m.side_effect = IOError("error!")
+ tutils.raises("empty reply", self.pathod, "304")
+
+
class TestHTTPS(tservers.HTTPProxTest, SanityMixin):
ssl = True