This is covered in issue 520. It's just that till now I was thinking my client is using multicast for discovery mechanism, as hazelcast client instance never thrown any exception while starting using the server XML and connected to node running on localhost.
Now my guess is when hazelcast client failed to connect to any server node after parsing the server XML, it used the default client XML configuration present in hazelcast-client.jar which always connects to localhost.
Even if this is expected behavior, client should log the name of xml as it's not the same configuration one expects it to be.
Example:
my-client-config.xml is same as server configuration with multicast discovery running with multiple nodes and one node on localhost and when I am creating the hazelcast instance it's connected to localhost. And if I kill the localhost node and run the same stuff again, it fails to connect.
ClientConfig conf = new XmlClientConfigBuilder("my-client-config.xml").build();
HazelcastInstance instance = HazelcastClient.newHazelcastClient(conf);