If he is still pre-mating age, it can usually be stopped. My own wonderful Isaac in my avatar started doing that at around 12 weeks of age. I'd scoop him up, grab his beak and hold it shut for a few seconds. He really hated that, would freeze in my arms. I'd thunk his beak as I put him down. He only did it a few times and then never again. He's one of the best roosters on the planet, my buddy, but it was really not in his nature to be human-aggressive anyway, coming from really good-tempered stock. So, do try that. It's pre-adult boundary testing at that age and if you nip it in the bud now (no pun intended), he may not progress to flogging. If he begins flogging as a mating adult, it's much harder, and usually impossible, in my own experience, to fix him.