A Unified View of Optimal Kernel Hypothesis Testing