Made SSL code thread safe. Fixed buffered writes mode with SSL.
Fixed write timeout not fire very quickly for SSL clients.