isConnected now checks if socket == null