Updated the validate function

Added validations for the self.host and self.port variables.