Allready this code is avaible at XLinkChannel#disconnect