Fixes #5: selected() not run for cached sessions.

Now properly calling the selected() method on the client in case of
SSL session resumption.

Also completely rewrote tests to cover more cases.