Add tests for SSL connections.
Incorrect assertion when closing SSL connections.

Fix #22.