Taiwan's military says it has canceled a contract that led to Chinese routers being used by the armed forces.