Check if socket is connected and if so throw exception when connect() is invoked