diff options
-rw-r--r-- | libmproxy/proxy.py | 7 | ||||
-rw-r--r-- | test/test_proxy.py | 2 |
2 files changed, 3 insertions, 6 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index ae5cd7d3..b1a5f084 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -85,12 +85,9 @@ class ServerConnection(tcp.TCPClient): if self.connection: try: self.wfile.flush() - except IOError, tcp.NetLibDisconnect: # pragma: no cover - pass - try: - self.connection.close() - except IOError: + except tcp.NetLibDisconnect: # pragma: no cover pass + self.connection.close() diff --git a/test/test_proxy.py b/test/test_proxy.py index 5828d077..c5640d8a 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -56,7 +56,7 @@ class TestServerConnection: sc = proxy.ServerConnection(proxy.ProxyConfig(), "http", self.d.IFACE, self.d.port, "host.com") sc.connect() sc.connection = mock.Mock() - sc.connection.close = mock.Mock(side_effect=IOError) + sc.connection.flush = mock.Mock(side_effect=tcp.NetLibDisconnect) sc.terminate() |