You have to be in a boring class.
Make sure that the teacher doesn't notice you.
Get bored.
Don't cure the boringness. (eg. No talking to friends, drawing, etc)
Don't try to listen to the class either.
When the perfect opportunity presents itself (like if the teacher is showing a boring movie), take your chance.
Goal achieved.