support tornado 4.0

fix #771
Merge pull request #826 from benoitc/fix/771

support tornado 4.0