Autodetect of connect() status

It will be now automatically detected in socket constructor whether a
socket is connected or not