Make NPE message more explicit when passing a null hostname to avoid proxy, close #560, close #561