Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.XMPPConnection.connect()


        // config.setDebuggerEnabled(true);

        try {
            // SmackConfiguration.setPacketReplyTimeout(1000);
            XMPPConnection con = new XMPPConnection(config);
            con.connect();
            con.login("amq-user", "amq-pwd");
            ChatManager chatManager = con.getChatManager();
            Chat chat = chatManager.createChat("test@localhost", new MessageListener() {
                public void processMessage(Chat chat, Message message) {
                    LOG.info("Got XMPP message from chat " + chat.getParticipant() + " message - " + message.getBody());
View Full Code Here


    public void testChat() throws Exception {
        ConnectionConfiguration config = new ConnectionConfiguration("localhost", 61222);
        //config.setDebuggerEnabled(true);

        XMPPConnection consumerCon = new XMPPConnection(config);
        consumerCon.connect();
        consumerCon.login("consumer", "consumer");
        consumerCon.addPacketListener(new XmppLogger("CONSUMER INBOUND"), new PacketFilter() {
            public boolean accept(Packet packet) {
                return true;
            }
View Full Code Here

                chat.addMessageListener(listener);
            }
        });

        XMPPConnection producerCon = new XMPPConnection(config);
        producerCon.connect();
        producerCon.login("producer", "producer");
        producerCon.addPacketListener(new XmppLogger("PRODUCER INBOUND"), new PacketFilter() {
            public boolean accept(Packet packet) {
                return true;
            }
View Full Code Here

    long connectionHandle = ((IntegerValue) args[0].itemAt(0)).getLong();
    XMPPConnection connection = XMPPModule.retrieveConnection(connectionHandle);

    try
    {
      connection.connect();
      return BooleanValue.TRUE;
     
    } catch (XMPPException e) {
      return BooleanValue.FALSE;
    }
View Full Code Here

            }
        } else {
            connection = new XMPPConnection(host);
        }

        connection.connect();

        if (login && !connection.isAuthenticated()) {
            if (user != null) {
                LOG.info("Logging in to XMPP as user: " + user + " on connection: " + connection);
                if (password == null) {
View Full Code Here

            }
        } else {
            connection = new XMPPConnection(host);
        }

        connection.connect();

        if (login && !connection.isAuthenticated()) {
            if (user != null) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Logging in to XMPP as user: " + user + " on connection: " + getConnectionMessage(connection));
View Full Code Here

        // config.setDebuggerEnabled(true);

        try {
            // SmackConfiguration.setPacketReplyTimeout(1000);
            XMPPConnection con = new XMPPConnection(config);
            con.connect();
            con.login("amq-user", "amq-pwd");
            Chat chat = con.getChatManager().createChat("test@localhost",
                new MessageListener() {
                    public void processMessage(Chat chat, Message message) {
                        //
View Full Code Here

            }
        } else {
            connection = new XMPPConnection(host);
        }

        connection.connect();

        if (login && !connection.isAuthenticated()) {
            if (user != null) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Logging in to XMPP as user: " + user + " on connection: " + getConnectionMessage(connection));
View Full Code Here

    if(!p.load()) {
      return;
    }
   
    XMPPConnection connection = new XMPPConnection(p.fJabberServer);
    connection.connect();
    connection.login(p.fJabberLogin, p.fJabberPassword);
    final Chat chat = connection.getChatManager().createChat(p.fJabberAdmin, new MessageListener() {

        public void processMessage(Chat chat, Message message) {
            System.out.println("Received message: " + message.getThread() + " " + message.getBody());
View Full Code Here

             connection = new XMPPConnection(conf);
           } else {
             connection = new XMPPConnection(service);
           }

           connection.connect();
           System.out.println("Connected to " + connection.getHost());

        } catch (XMPPException ex) {
            Logger.getLogger(JabberWorkItemHandler.class.getName()).log(Level.SEVERE, null, ex);
            System.out.println("Failed to connect to " + connection.getHost());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.