Headset Control for Google Voice Search

So I see that there is this feature listed by Google:

If you're using a wired headset, long press the headset's button to activate Voice Search. You can quickly perform a search query by voice and have the result read back to you.

Have anyone tried this? At least I didn't get this to work with my headphone (I'm using a Nexus 4).

By the way, can this be used when the phone is asleep? So I don't even have to take my phone out of my pocket to get things done.