During a stressful event, the endocrine and autonomic nervous systems work together. When a stressor (like a friend startling you) is detected, the hypothalamus activates the sympathetic branch, shifting the body from its resting parasympathetic state to an active, aroused state. This triggers the release of adrenaline from the adrenal medulla into the bloodstream, which increases heart rate and prepares the body for the fight-or-flight response.