Use newer TLS functions when available

This removes the deprecation warnings on node.js 0.11.13+ when using
SSL.

fixes #809