Unit/regression test for TLS heartbeats.

Regression test against CVE-2014-0160 (Heartbleed).

More info: http://mike-bland.com/tags/heartbleed.html

(cherry picked from commit a7a9e18b550edf059dfd54683ac1f45170ff9fb2)