changed hostname resolve section

now it tries to establish connection to resolved IP address
Updated unit tests