My Okeeta corn and my king both do this on occasion. It is normal behavior. You might of just caught him off guard and he went into defensive behavior. IMO once they get their dander up, just give them a bit of time to calm down. If you need to get them out of the cage right then, for whatever reason, I use a snake hook. Normally once I get a hold of them they are pretty active but ok (not trying to bite me) Betty rattles her tail quite often. In the wild this is to let people know that she is there and to ward off predators. Don't worry it is not a constant behavior, my Betty is still a very sweet snake and can be handled easily. She tends to do it the most right before I feed her. I take her out of her cage and put her in a container to feed her. She knows when she goes in that box food is on its way and she gets pretty excited.
Don't let it worry you. :wavey: