A Hypothesis Testing Framework for Network Security