If there's anything illegal about the Pokemon, be it ability, move or met conditions, the game will automatically "interrupt your connection" with the other trainer. This happened to me the first time I injected hacked Pokemon created by somebody else, which led me to hacking my own Pokemon so they can battle online.