Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.XMPPException


        clearCandidates();

        if (!RTPBridge.serviceAvailable(connection)) {
            setInitialized();
            throw new XMPPException("No RTP Bridge service available");
        }
        setInitialized();

    }
View Full Code Here


            DataInputStream in = new DataInputStream(socket.getInputStream());

            // first byte is version should be 5
            int b = in.read();
            if (b != 5) {
                throw new XMPPException("Only SOCKS5 supported");
            }

            // second byte number of authentication methods supported
            b = in.read();

            // read list of supported authentication methods
            byte[] auth = new byte[b];
            in.readFully(auth);

            byte[] authMethodSelectionResponse = new byte[2];
            authMethodSelectionResponse[0] = (byte) 0x05; // protocol version

            // only authentication method 0, no authentication, supported
            boolean noAuthMethodFound = false;
            for (int i = 0; i < auth.length; i++) {
                if (auth[i] == (byte) 0x00) {
                    noAuthMethodFound = true;
                    break;
                }
            }

            if (!noAuthMethodFound) {
                authMethodSelectionResponse[1] = (byte) 0xFF; // no acceptable methods
                out.write(authMethodSelectionResponse);
                out.flush();
                throw new XMPPException("Authentication method not supported");
            }

            authMethodSelectionResponse[1] = (byte) 0x00; // no-authentication method
            out.write(authMethodSelectionResponse);
            out.flush();
View Full Code Here

        // Stop queuing results
        response.cancel();

        if (result == null) {
            throw new XMPPException("No response from server.");
        }
        else if (result.getError() != null) {
            throw new XMPPException(result.getError());
        }
        return result;
  }
View Full Code Here

        progress.beginTask("Connection Test with buddy " + plainJID, 68);
        try {
            Connection connection = sarosNet.getConnection();
            if (connection == null || !connection.isConnected())
                throw new XMPPException("Connection is not established!");
            progress.worked(1);

            String id = Packet.nextID();

            progress.subTask("Checking if buddy is using Saros");
            JID user = discoManager.getSupportingPresence(plainJID,
                Saros.NAMESPACE);
            if (user == null)
                throw new XMPPException("Buddy " + plainJID
                    + " is not using Saros");
            progress.worked(1);

            TransferDescription transferData = TransferDescription
                .createTestTransferDescription(user, id, sarosNet.getMyJID());

            progress.subTask("Generating Test Data");
            byte[] testData = getTestArray(size);
            progress.worked(1);

            // Create a packet collector to listen for a response.
            PacketCollector collector = connection
                .createPacketCollector(new PacketIDFilter(id));

            StopWatch watch = new StopWatch().start();

            try {
                try {
                    progress.subTask("Sending Data");
                    dataTransferManager.sendData(transferData, testData,
                        progress.newChild(40));
                } catch (IOException e) {
                    throw new XMPPException("IOException sending data", e);
                } catch (SarosCancellationException e) {
                    throw new XMPPException(
                        "CancellationException sending data", e);
                }

                progress.subTask("Waiting for reply");
                ConnectionTestResponse response = null;
                for (int i = 0; i < 15; i++) {
                    response = responseProvider.getPayload(collector
                        .nextResult(1000));
                    if (response != null)
                        break;
                    progress.worked(1);
                }

                result.transferTime = watch.stop().getTime();

                if (response == null)
                    throw new XMPPException("Timeout after 15s");

                if (response.errorMessage != null)
                    throw new XMPPException("An remote error occurred: "
                        + response.errorMessage);

                int localDataHash = Arrays.hashCode(testData);
                if (response.dataHash != localDataHash)
                    throw new XMPPException(
                        "Hash results don't match: Received=="
                            + response.dataHash + " expected==" + localDataHash);

                result.mode = response.transferMode;
View Full Code Here

            monitor.worked(1);

            String errorMessage = isAccountCreationPossible(connection,
                username);
            if (errorMessage != null)
                throw new XMPPException(errorMessage);

            monitor.worked(1);

            AccountManager manager = connection.getAccountManager();
            manager.createAccount(username, password);
View Full Code Here

                    } catch (Exception e) {
                        log.debug("Error opening questionMessageDialog", e);
                    }

                    if (cancel) {
                        throw new InvocationTargetException(new XMPPException(
                            "Please make sure you spelled the JID correctly."));
                    }
                    log.debug("The buddy " + jid
                        + " couldn't be found on the server."
                        + " The user chose to add it anyway.");
View Full Code Here

     *             is thrown if no connection is established.
     */
    public static void removeFromRoster(Connection connection,
        RosterEntry rosterEntry) throws XMPPException {
        if (!connection.isConnected()) {
            throw new XMPPException("Not connected");
        }
        connection.getRoster().removeEntry(rosterEntry);
    }
View Full Code Here

                LOG.error("Server " + server + " does not support XEP-0077"
                    + " (In-Band Registration) properly:", e);
            }
            if (registration != null) {
                if (registration.getAttributes().containsKey("registered")) {
                    throw new XMPPException("Account " + username
                        + " already exists on server");
                }
                if (!registration.getAttributes().containsKey("username")) {
                    String instructions = registration.getInstructions();
                    if (instructions != null) {
                        throw new XMPPException(
                            "Registration via Saros not possible. Please follow these instructions:\n"
                                + instructions);
                    } else {
                        throw new XMPPException(
                            "Registration via Saros not supported by Server. Please see the server web site for informations for how to create an account");
                    }
                }
            }
            monitor.worked(1);
View Full Code Here

        // Stop queuing results
        response.cancel();

        if (result == null) {
            throw new XMPPException("No response from server.");
        }
        else if (result.getError() != null) {
            throw new XMPPException(result.getError());
        }
        return result;
  }
View Full Code Here

     * @param connection the connection for persisting and retrieving bookmarks.
     * @throws XMPPException thrown when the connection is null or has not been authenticated.
     */
    private BookmarkManager(Connection connection) throws XMPPException {
        if(connection == null || !connection.isAuthenticated()) {
            throw new XMPPException("Invalid connection.");
        }
        this.privateDataManager = new PrivateDataManager(connection);
    }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.XMPPException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.