How to change my status and get status of an user

I using Smack 4.1.1

I make below, but it not working. Someone can help me?

// Change status

Presence presence = new Presence(Presence.Type.available);

connection.sendStanza(presence);

// Check status

Roster roster = Roster.getInstanceFor(connection);

try {

if (!roster.isLoaded()){

roster.reloadAndWait();

}

} catch (NotLoggedInException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (NotConnectedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

Presence presence = roster.getPresence(getUserJID(userId));

return presence.isAvailable();