'Test the connection is cleaned up after an invalid response'

def test_invalid_closed(self):

    conn = test_urllib.fakehttp('')
    handler = urllib.request.AbstractHTTPHandler()
    req = Request('http://dummy/')
    req.timeout = None
    with self.assertRaises(http.client.BadStatusLine):
        handler.do_open(conn, req)
    self.assertTrue(conn.fakesock.closed, 'Connection    not    closed')
