Leave a border town with them "under-guarded" with only a few garrisons. However, keep a strong force not far away deeper in your border. The AI will attack a weakly-defended city (they are aggressive...) even if you are allies with them. Use the strong army you prepared to repel them and proceed with the (counter-)invasion.