added validations for socketstream connection failure