In order to use this code you should add some users to your Roster (Contact list).
While adding some users - these users will receive Roster request and will be able to add you as well.
After that you Roster will contain some entries and you can iterate through it.