Earlier this year, U.S. and Qatari officials met in Doha to simulate a hostage situation. The exercise was fast-moving and hazardous: Islamic State militants in Somalia had seized four aid workers, two Americans and two Qataris. One of the Americans was gravely injured, and the group had to decide whether to attempt a rescue.