Java源码示例:org.jivesoftware.smack.SmackException.NotConnectedException

示例1
/**
 * As the given provisioning server is the given JID is a friend.
 *
 * @param provisioningServer the provisioning server to ask.
 * @param friendInQuestion the JID to ask about.
 * @return <code>true</code> if the JID is a friend, <code>false</code> otherwise.
 * @throws NoResponseException if there was no response from the remote entity.
 * @throws XMPPErrorException if there was an XMPP error returned.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public boolean isFriend(Jid provisioningServer, BareJid friendInQuestion) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    LruCache<BareJid, Void> cache = negativeFriendshipRequestCache.lookup(provisioningServer);
    if (cache != null && cache.containsKey(friendInQuestion)) {
        // We hit a cached negative isFriend response for this provisioning server.
        return false;
    }

    IoTIsFriend iotIsFriend = new IoTIsFriend(friendInQuestion);
    iotIsFriend.setTo(provisioningServer);
    IoTIsFriendResponse response = connection().createStanzaCollectorAndSend(iotIsFriend).nextResultOrThrow();
    assert response.getJid().equals(friendInQuestion);
    boolean isFriend = response.getIsFriendResult();
    if (!isFriend) {
        // Cache the negative is friend response.
        if (cache == null) {
            cache = new LruCache<>(1024);
            negativeFriendshipRequestCache.put(provisioningServer, cache);
        }
        cache.put(friendInQuestion, null);
    }
    return isFriend;
}
 
示例2
@Override
public StanzaCollector createStanzaCollectorAndSend(StanzaFilter packetFilter, Stanza packet)
                throws NotConnectedException, InterruptedException {
    StanzaCollector.Configuration configuration = StanzaCollector.newConfiguration()
                    .setStanzaFilter(packetFilter)
                    .setRequest(packet);
    // Create the packet collector before sending the packet
    StanzaCollector packetCollector = createStanzaCollector(configuration);
    try {
        // Now we can send the packet as the collector has been created
        sendStanza(packet);
    }
    catch (InterruptedException | NotConnectedException | RuntimeException e) {
        packetCollector.cancel();
        throw e;
    }
    return packetCollector;
}
 
示例3
@Override
public IQ handleIQRequest(final IQ packet) {
    initiationListenerExecutor.execute(new Runnable() {

        @Override
        public void run() {
            try {
                processRequest(packet);
            }
            catch (InterruptedException | NotConnectedException e) {
                LOGGER.log(Level.WARNING, "proccessRequest", e);
            }
        }
    });
    return null;
}
 
示例4
/**
 * Retrieves the AgentChatHistory associated with a particular agent jid.
 *
 * @param jid the jid of the agent.
 * @param maxSessions the max number of sessions to retrieve.
 * @param startDate point in time from which on history should get retrieved.
 * @return the chat history associated with a given jid.
 * @throws XMPPException if an error occurs while retrieving the AgentChatHistory.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public AgentChatHistory getAgentHistory(EntityBareJid jid, int maxSessions, Date startDate) throws XMPPException, NotConnectedException, InterruptedException {
    AgentChatHistory request;
    if (startDate != null) {
        request = new AgentChatHistory(jid, maxSessions, startDate);
    }
    else {
        request = new AgentChatHistory(jid, maxSessions);
    }

    request.setType(IQ.Type.get);
    request.setTo(workgroupJID);

    AgentChatHistory response = connection.createStanzaCollectorAndSend(
                    request).nextResult();

    return response;
}
 
示例5
/**
 * Sets the name associated with this entry.
 *
 * @param name the name.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws XMPPErrorException if there was an XMPP error returned.
 * @throws NoResponseException if there was no response from the remote entity.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public synchronized void setName(String name) throws NotConnectedException, NoResponseException, XMPPErrorException, InterruptedException {
    // Do nothing if the name hasn't changed.
    if (name != null && name.equals(getName())) {
        return;
    }

    RosterPacket packet = new RosterPacket();
    packet.setType(IQ.Type.set);

    // Create a new roster item with the current RosterEntry and the *new* name. Note that we can't set the name of
    // RosterEntry right away, as otherwise the updated event wont get fired, because equalsDeep would return true.
    packet.addRosterItem(toRosterItem(this, name));
    connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();

    // We have received a result response to the IQ set, the name was successfully changed
    item.setName(name);
}
 
示例6
/**
 *  Removes a url from the bookmarks.
 *
 * @param bookmarkURL the url of the bookmark to remove
 * @throws XMPPErrorException thrown if there is an error retriving or saving bookmarks from or to
 * the server.
 * @throws NoResponseException if there was no response from the server.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public void removeBookmarkedURL(String bookmarkURL) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    retrieveBookmarks();
    Iterator<BookmarkedURL> it = bookmarks.getBookmarkedURLS().iterator();
    while (it.hasNext()) {
        BookmarkedURL bookmark = it.next();
        if (bookmark.getURL().equalsIgnoreCase(bookmarkURL)) {
            if (bookmark.isShared()) {
                throw new IllegalArgumentException("Cannot delete a shared bookmark.");
            }
            it.remove();
            privateDataManager.setPrivateData(bookmarks);
            return;
        }
    }
}
 
示例7
@SuppressWarnings("FutureReturnValueIgnored")
@Override
public void addOneTimeSyncCallback(final StanzaListener callback, final StanzaFilter packetFilter) {
    final StanzaListener packetListener = new StanzaListener() {
        @Override
        public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException {
            try {
                callback.processStanza(packet);
            } finally {
                removeSyncStanzaListener(this);
            }
        }
    };
    addSyncStanzaListener(packetListener, packetFilter);
    schedule(new Runnable() {
        @Override
        public void run() {
            removeSyncStanzaListener(packetListener);
        }
    }, getReplyTimeout(), TimeUnit.MILLISECONDS);
}
 
示例8
/**
 * Returns a List of Messages with all the offline <code>Messages</code> of the user. The returned offline
 * messages will not be deleted from the server. Use {@link #deleteMessages(java.util.List)}
 * to delete the messages.
 *
 * @return a List with all the offline <code>Messages</code> of the user.
 * @throws XMPPErrorException If the user is not allowed to make this request or the server does
 *                       not support offline message retrieval.
 * @throws NoResponseException if there was no response from the server.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public List<Message> getMessages() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    OfflineMessageRequest request = new OfflineMessageRequest();
    request.setFetch(true);

    StanzaCollector resultCollector = connection().createStanzaCollectorAndSend(request);
    StanzaCollector.Configuration messageCollectorConfiguration = StanzaCollector.newConfiguration().setStanzaFilter(PACKET_FILTER).setCollectorToReset(resultCollector);

    List<Message> messages;
    try (StanzaCollector messageCollector = connection().createStanzaCollector(messageCollectorConfiguration)) {
        resultCollector.nextResultOrThrow();
        // Be extra safe, cancel the message collector right here so that it does not collector
        // other messages that eventually match (although I've no idea how this could happen in
        // case of XEP-13).
        messageCollector.cancel();
        messages = new ArrayList<>(messageCollector.getCollectedCount());
        Message message;
        while ((message = messageCollector.pollResult()) != null) {
            messages.add(message);
        }
    }
    return messages;
}
 
示例9
/**
 * This method is invoked if a request to close the In-Band Bytestream has been received.
 *
 * @param closeRequest the close request from the remote peer
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
protected void closeByPeer(Close closeRequest) throws NotConnectedException, InterruptedException {

    /*
     * close streams without flushing them, because stream is already considered closed on the
     * remote peers side
     */
    this.inputStream.closeInternal();
    this.inputStream.cleanup();
    this.outputStream.closeInternal(false);

    // acknowledge close request
    IQ confirmClose = IQ.createResultIQ(closeRequest);
    this.connection.sendStanza(confirmClose);

}
 
示例10
public ThingState registerThing(Jid registry, Thing thing)
                throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException, IoTClaimedException {
    final XMPPConnection connection = connection();
    IoTRegister iotRegister = new IoTRegister(thing.getMetaTags(), thing.getNodeInfo(), thing.isSelfOwened());
    iotRegister.setTo(registry);
    IQ result = connection.createStanzaCollectorAndSend(iotRegister).nextResultOrThrow();
    if (result instanceof IoTClaimed) {
        IoTClaimed iotClaimedResult = (IoTClaimed) result;
        throw new IoTClaimedException(iotClaimedResult);
    }

    ThingState state = getStateFor(thing.getNodeInfo());
    state.setRegistry(registry.asBareJid());

    interactWithRegistry(registry);

    IoTDataManager.getInstanceFor(connection).installThing(thing);
    IoTControlManager.getInstanceFor(connection).installThing(thing);

    return state;
}
 
示例11
/**
 * Sends the completed configuration form to the server. The room will be configured
 * with the new settings defined in the form.
 *
 * @param form the form with the new settings.
 * @throws XMPPErrorException if an error occurs setting the new rooms' configuration.
 * @throws NoResponseException if there was no response from the server.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public void sendConfigurationForm(FillableForm form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    final DataForm dataForm;
    if (form != null) {
        dataForm = form.getDataFormToSubmit();
    } else {
        // Instant room, cf. XEP-0045 § 10.1.2
        dataForm = DataForm.builder().build();
    }

    MUCOwner iq = new MUCOwner();
    iq.setTo(room);
    iq.setType(IQ.Type.set);
    iq.addExtension(dataForm);

    connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
}
 
示例12
/**
 * Query for metadata associated with a session id.
 *
 * @param sessionID the sessionID to query for.
 * @return Map a map of all metadata associated with the sessionID.
 * @throws XMPPException if an error occurs while getting information from the server.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public Map<String, List<String>> getChatMetadata(String sessionID) throws XMPPException, NotConnectedException, InterruptedException {
    ChatMetadata request = new ChatMetadata();
    request.setType(IQ.Type.get);
    request.setTo(workgroupJID);
    request.setSessionID(sessionID);

    ChatMetadata response = connection.createStanzaCollectorAndSend(request).nextResult();

    return response.getMetadata();
}
 
示例13
public static void mucInvitation() {
	MultiUserChatManager.getInstanceFor(Launcher.connection).addInvitationListener(new InvitationListener() {
		@Override
		public void invitationReceived(XMPPConnection conn, MultiUserChat room, EntityJid inviter, String reason,
				String password, Message message, Invite invitation) {
			String barejid = message.getFrom().toString();
			DebugUtil.debug("被邀请加入群聊:" + barejid + reason);
			try {

				room.join(Resourcepart.from(UserCache.CurrentUserName + "-" + UserCache.CurrentUserRealName));

				if (barejid != null) {
					if (Launcher.currRoomId.equals(barejid)) {
						// 当前聊天者即为已有群
						// updateChatPanel(message);
					} else {
						if (Launcher.roomService.exist(barejid)) {
							// 联系人列表中存在群组,更新未读信息,则修改
							// updateRoom(message);
						} else {
							// 联系人中不存在群组,则新建一个群
							createNewRoom(message);
						}
						// dbMessagePersistence(message);
					}
				}

			} catch (NotAMucServiceException | NoResponseException | XMPPErrorException | NotConnectedException
					| XmppStringprepException | InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}

	});
}
 
示例14
private void sendTopLevelStreamElement(TopLevelStreamElement element) throws NotConnectedException, InterruptedException {
    final XmppClientToServerTransport transport = activeTransport;
    if (transport == null) {
        throw new NotConnectedException();
    }

    outgoingElementsQueue.put(element);
    transport.notifyAboutNewOutgoingElements();
}
 
示例15
/**
 * Client declines the use of default lists.
 * @throws XMPPErrorException if there was an XMPP error returned.
 * @throws NoResponseException if there was no response from the remote entity.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setDeclineDefaultList(true);

    // Send the package to the server
    setRequest(request);
}
 
示例16
/**
 * Disconnects from chatserver and releases all resources.
 */
public void disconnect() {
	connection.getRoster().removeRosterListener(leagueRosterListener);
	try {
		connection.disconnect();
	} catch (final NotConnectedException e) {
		e.printStackTrace();
	}
	stop = true;
}
 
示例17
/**
 * Deletes this friend.
 * 
 * @return true if succesful, otherwise false
 */
public boolean delete() {
	try {
		con.getRoster().removeEntry(get());
		return true;
	} catch (XMPPException | NotLoggedInException | NoResponseException
			| NotConnectedException e) {
		e.printStackTrace();
	}
	return false;
}
 
示例18
public Time getTime(Jid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    if (!isTimeSupported(jid))
        return null;

    Time request = new Time();
    // TODO Add Time(Jid) constructor and use this constructor instead
    request.setTo(jid);
    return connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
}
 
示例19
@Override
protected void throwNotConnectedExceptionIfAppropriate() throws NotConnectedException {
    if (packetWriter == null) {
        throw new NotConnectedException();
    }
    packetWriter.throwNotConnectedExceptionIfDoneAndResumptionNotPossible();
}
 
示例20
public boolean isSupported()
                throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    XMPPConnection connection = connection();
    ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);
    BareJid localBareJid = connection.getUser().asBareJid();
    return serviceDiscoveryManager.supportsFeatures(localBareJid, REQUIRED_FEATURES);
}
 
示例21
/**
 * Trigger a Transport session established event.
 *
 * @param local  TransportCandidate that has been agreed.
 * @param remote TransportCandidate that has been agreed.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException {
    List<JingleListener> listeners = getListenersList();
    for (JingleListener li : listeners) {
        if (li instanceof JingleTransportListener) {
            JingleTransportListener mli = (JingleTransportListener) li;
            LOGGER.fine("triggerTransportEstablished " + local.getLocalIp() + ":" + local.getPort() + " <-> "
                    + remote.getIp() + ":" + remote.getPort());
            mli.transportEstablished(local, remote);
        }
    }
}
 
示例22
@Override
public OutputStream createOutgoingStream(String streamID, Jid initiator,
                Jid target) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    InBandBytestreamSession session = this.manager.establishSession(target, streamID);
    session.setCloseBothStreamsEnabled(true);
    return session.getOutputStream();
}
 
示例23
/**
 * Performs SASL authentication of the specified user. If SASL authentication was successful
 * then resource binding and session establishment will be performed. This method will return
 * the full JID provided by the server while binding a resource to the connection.<p>
 *
 * The server may assign a full JID with a username or resource different than the requested
 * by this method.
 *
 * @param username the username that is authenticating with the server.
 * @param password the password to send to the server.
 * @param authzid the authorization identifier (typically null).
 * @param sslSession the optional SSL/TLS session (if one was established)
 * @return the used SASLMechanism.
 * @throws XMPPErrorException if there was an XMPP error returned.
 * @throws SASLErrorException if a SASL protocol error was returned.
 * @throws IOException if an I/O error occurred.
 * @throws InterruptedException if the calling thread was interrupted.
 * @throws SmackSaslException if a SASL specific error occurred.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws NoResponseException if there was no response from the remote entity.
 */
SASLMechanism authenticate(String username, String password, EntityBareJid authzid, SSLSession sslSession)
                throws XMPPErrorException, SASLErrorException, IOException,
                InterruptedException, SmackSaslException, NotConnectedException, NoResponseException {
    final SASLMechanism mechanism = selectMechanism(authzid);
    final CallbackHandler callbackHandler = configuration.getCallbackHandler();
    final String host = connection.getHost();
    final DomainBareJid xmppServiceDomain = connection.getXMPPServiceDomain();

    synchronized (this) {
        currentMechanism = mechanism;

        if (callbackHandler != null) {
            currentMechanism.authenticate(host, xmppServiceDomain, callbackHandler, authzid, sslSession);
        }
        else {
            currentMechanism.authenticate(username, host, xmppServiceDomain, password, authzid, sslSession);
        }

        final long deadline = System.currentTimeMillis() + connection.getReplyTimeout();
        while (!mechanism.isFinished()) {
            final long now = System.currentTimeMillis();
            if (now >= deadline) break;
            // Wait until SASL negotiation finishes
            wait(deadline - now);
        }
    }

    mechanism.throwExceptionIfRequired();

    return mechanism;
}
 
示例24
/**
 * Send a request to another user to send them a file. The other user has
 * the option of, accepting, rejecting, or not responding to a received file
 * transfer request.
 * <p>
 * If they accept, the stanza will contain the other user's chosen stream
 * type to send the file across. The two choices this implementation
 * provides to the other user for file transfer are <a
 * href="http://www.xmpp.org/extensions/jep-0065.html">SOCKS5 Bytestreams</a>,
 * which is the preferred method of transfer, and <a
 * href="http://www.xmpp.org/extensions/jep-0047.html">In-Band Bytestreams</a>,
 * which is the fallback mechanism.
 * </p>
 * <p>
 * The other user may choose to decline the file request if they do not
 * desire the file, their client does not support XEP-0096, or if there are
 * no acceptable means to transfer the file.
 * </p>
 * Finally, if the other user does not respond this method will return null
 * after the specified timeout.
 *
 * @param userID          The userID of the user to whom the file will be sent.
 * @param streamID        The unique identifier for this file transfer.
 * @param fileName        The name of this file. Preferably it should include an
 *                        extension as it is used to determine what type of file it is.
 * @param size            The size, in bytes, of the file.
 * @param desc            A description of the file.
 * @param responseTimeout The amount of time, in milliseconds, to wait for the remote
 *                        user to respond. If they do not respond in time, this
 * @return Returns the stream negotiator selected by the peer.
 * @throws XMPPErrorException Thrown if there is an error negotiating the file transfer.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws NoResponseException if there was no response from the remote entity.
 * @throws NoAcceptableTransferMechanisms if no acceptable transfer mechanisms are available
 * @throws InterruptedException if the calling thread was interrupted.
 */
public StreamNegotiator negotiateOutgoingTransfer(final Jid userID,
        final String streamID, final String fileName, final long size,
        final String desc, int responseTimeout) throws XMPPErrorException, NotConnectedException, NoResponseException, NoAcceptableTransferMechanisms, InterruptedException {
    StreamInitiation si = new StreamInitiation();
    si.setSessionID(streamID);
    si.setMimeType(URLConnection.guessContentTypeFromName(fileName));

    StreamInitiation.File siFile = new StreamInitiation.File(fileName, size);
    siFile.setDesc(desc);
    si.setFile(siFile);

    si.setFeatureNegotiationForm(createDefaultInitiationForm());

    si.setFrom(connection().getUser());
    si.setTo(userID);
    si.setType(IQ.Type.set);

    Stanza siResponse = connection().createStanzaCollectorAndSend(si).nextResultOrThrow(
                    responseTimeout);

    if (siResponse instanceof IQ) {
        IQ iqResponse = (IQ) siResponse;
        if (iqResponse.getType().equals(IQ.Type.result)) {
            StreamInitiation response = (StreamInitiation) siResponse;
            return getOutgoingNegotiator(getStreamMethodField(response
                    .getFeatureNegotiationForm()));

        }
        else {
            throw new XMPPErrorException(iqResponse, iqResponse.getError());
        }
    }
    else {
        return null;
    }
}
 
示例25
private synchronized void flushBuffer() throws IOException {

            // do nothing if no data to send available
            if (bufferPointer == 0) {
                return;
            }

            // create data packet
            String enc = Base64.encodeToString(buffer, 0, bufferPointer);
            DataPacketExtension data = new DataPacketExtension(byteStreamRequest.getSessionID(),
                            this.seq, enc);

            // write to XMPP stream
            try {
                writeToXML(data);
            }
            catch (InterruptedException | NotConnectedException e) {
                IOException ioException = new IOException();
                ioException.initCause(e);
                throw ioException;
            }

            // reset buffer pointer
            bufferPointer = 0;

            // increment sequence, considering sequence overflow
            this.seq = this.seq + 1 == 65535 ? 0 : this.seq + 1;

        }
 
示例26
/**
 * Leave the MUCLight.
 *
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 * @throws NoResponseException if there was no response from the remote entity.
 * @throws XMPPErrorException if there was an XMPP error returned.
 */
public void leave() throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException {
    HashMap<Jid, MUCLightAffiliation> affiliations = new HashMap<>();
    affiliations.put(connection.getUser(), MUCLightAffiliation.none);

    MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations);
    IQ responseIq = connection.createStanzaCollectorAndSend(changeAffiliationsIQ).nextResultOrThrow();
    boolean roomLeft = responseIq.getType().equals(IQ.Type.result);

    if (roomLeft) {
        removeConnectionCallbacks();
    }
}
 
示例27
/**
 * Creates an instant node, if supported.
 *
 * @return The node that was created
 * @throws XMPPErrorException if there was an XMPP error returned.
 * @throws NoResponseException if there was no response from the remote entity.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    PubSub reply = sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.CREATE), null);
    QName qname = new QName(PubSubNamespace.basic.getXmlns(), "create");
    NodeExtension elem = (NodeExtension) reply.getExtension(qname);

    LeafNode newNode = new LeafNode(this, elem.getNode());
    nodeMap.put(newNode.getId(), newNode);

    return newNode;
}
 
示例28
/**
 * Destroy the MUC Light. Only will work if it is requested by the owner.
 *
 * @throws NoResponseException if there was no response from the remote entity.
 * @throws XMPPErrorException if there was an XMPP error returned.
 * @throws NotConnectedException if the XMPP connection is not connected.
 * @throws InterruptedException if the calling thread was interrupted.
 */
public void destroy() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
    MUCLightDestroyIQ mucLightDestroyIQ = new MUCLightDestroyIQ(room);
    IQ responseIq = connection.createStanzaCollectorAndSend(mucLightDestroyIQ).nextResultOrThrow();
    boolean roomDestroyed = responseIq.getType().equals(IQ.Type.result);

    if (roomDestroyed) {
        removeConnectionCallbacks();
    }
}
 
示例29
public PubSubIntegrationTest(SmackIntegrationTestEnvironment environment)
                throws TestNotPossibleException, NoResponseException, XMPPErrorException,
                NotConnectedException, InterruptedException {
    super(environment);
    DomainBareJid pubSubService = PubSubManager.getPubSubService(conOne);
    if (pubSubService == null) {
        throw new TestNotPossibleException("No PubSub service found");
    }
    pubSubManagerOne = PubSubManager.getInstanceFor(conOne, pubSubService);
    if (!pubSubManagerOne.canCreateNodesAndPublishItems()) {
        throw new TestNotPossibleException("PubSub service does not allow node creation");
    }
}
 
示例30
private void interactWithRegistry(Jid registry) throws NotConnectedException, InterruptedException {
    boolean isNew = usedRegistries.add(registry);
    if (!isNew) {
        return;
    }
    IoTProvisioningManager iotProvisioningManager = IoTProvisioningManager.getInstanceFor(connection());
    iotProvisioningManager.sendFriendshipRequestIfRequired(registry.asBareJid());
}