add exception handling of connection refused