Fix SSL handshake event processing.

Poll for events using select.
Catch socket timeout exception.
Do not try to use IOLoop to handle socket events.
Remove unused class variable DO_HANDSHAKE.