Changes related to bootstrap.

1. Probe open port before bootstrapping.
2. Added more validation in bootstrap.
3. Added unit test for bootstrap.
4. Indentation changes.