validatePort can be static.