MenuItem timeItem = new MenuItem("Get time");
timeItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
EntityTimeManager entityTimeManager = xmppSession.getExtensionManager(EntityTimeManager.class);
try {
EntityTime entityTime = entityTimeManager.getEntityTime(Jid.valueOf("juliet@example.net/balcony"));
} catch (XmppException e) {
if (e instanceof NoResponseException) {
// The entity did not respond
} else if (e instanceof StanzaException) {
StanzaError stanzaError = ((StanzaException) e).getStanza().getError();