Update manual tls test to include heartbeat; fix bugs.