add a class for getting hostname.
fix standalone test