I suspect that this code can be written without complecting statusPromise with sslDone, isn't what you want to do is to defer statusPromise until sslDone is successful?