Add exception handling for connection refused