Fix null pointer exception in CoapClient
If a time out occurs in the discover request the variable link is set to
null. This caused a null pointer exception.