Permalink
Browse files

Merge remote-tracking branch 'evanj/master' into merge

  • Loading branch information...
2 parents 0e6540b + aaab26a commit b9d94fd1ad502117b42b1333a2aa89dea32f0b9c @bdarnell bdarnell committed Aug 20, 2012
Showing with 10 additions and 1 deletion.
  1. +4 −1 tornado/simple_httpclient.py
  2. +6 −0 tornado/test/simple_httpclient_test.py
@@ -326,7 +326,10 @@ def cleanup(self):
def _on_close(self):
if self.final_callback is not None:
- raise HTTPError(599, "Connection closed")
+ message = "Connection closed"
+ if self.stream.error:
+ message = str(self.stream.error)
+ raise HTTPError(599, message)
def _on_headers(self, data):
data = native_str(data.decode("latin1"))
@@ -283,6 +283,12 @@ def test_host_header(self):
response = self.wait()
self.assertTrue(host_re.match(response.body), response.body)
+ def test_connection_refused(self):
+ self.http_client.fetch("http://localhost:1/", self.stop)
+ response = self.wait()
+ self.assertEqual(599, response.code)
+ self.assertIn("Connection refused", str(response.error))
+
class CreateAsyncHTTPClientTestCase(AsyncTestCase, LogTrapTestCase):
def setUp(self):

0 comments on commit b9d94fd

Please sign in to comment.