In the Star Destroyer mission of Battlefront Elite Squadron, you play as X2 and have to defeat X1. My approach was to push him up against a railing, which pinned him in place.
From there, I just kept hitting him with my electric stick until he went down. Cornering him first makes the fight much easier.