Package org.jivesoftware.smack

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


      XMPPConnection c = new XMPPConnection(connConfig);
     
        c.connect();
        c.login(username, passwd, resource);       
        Presence presence = new Presence(Presence.Type.available);
        c.sendPacket(presence);
       
        return c;
    }
   
  @Before public void setUp() throws Exception {
View Full Code Here


                LOG.info("Logging in anonymously to XMPP on connection: " + connection);
                connection.loginAnonymously();
            }

            // now lets send a presence
            connection.sendPacket(new Presence(Presence.Type.AVAILABLE));
        }
        return connection;
    }

    public boolean isSingleton() {
View Full Code Here

            if (to != null) {
                Presence presence = new Presence(Presence.Type.subscribe);
                presence.setFrom(connection.getUser());
                String toEntity = to + "@vysper.org";
                presence.setTo(toEntity);
                connection.sendPacket(presence);

                chat = connection.getChatManager().createChat(toEntity, new MessageListener() {
                    public void processMessage(Chat inchat, Message message) {
                        System.out.println("log received message: " + message.getBody());
                    }
View Full Code Here

                        System.out.println("log received message: " + message.getBody());
                    }
                });
            }

            connection.sendPacket(new Presence(Presence.Type.available, "pommes", 1, Presence.Mode.available));

            Thread.sleep(1000);

            // query server version
            sendIQGetWithTimestamp(connection, new Version());
View Full Code Here

            //                chat.sendMessage("Hello " + to + " at " + new Date());
                            try { Thread.sleep((new Random().nextInt(15)+1)*1000 ); } catch (InterruptedException e) { ; }
                        }*/

            for (int i = 0; i < 10; i++) {
                connection.sendPacket(new Presence(Presence.Type.available, "pommes", 1, Presence.Mode.available));
                try {
                    Thread.sleep((new Random().nextInt(15) + 10) * 1000);
                } catch (InterruptedException e) {
                    ;
                }
View Full Code Here

                try {
                    Thread.sleep((new Random().nextInt(15) + 10) * 1000);
                } catch (InterruptedException e) {
                    ;
                }
                connection.sendPacket(new Presence(Presence.Type.available, "nickes", 1, Presence.Mode.away));
                try {
                    Thread.sleep((new Random().nextInt(15) + 10) * 1000);
                } catch (InterruptedException e) {
                    ;
                }
View Full Code Here

        try{
            connection.login(user, password);
            System.out.println("Logged in as " + connection.getUser());
            Presence presence = new Presence(Presence.Type.available);
            connection.sendPacket(presence);

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

                LOG.info("Logging in anonymously to XMPP on connection: " + connection);
                connection.loginAnonymously();
            }

            // now lets send a presence
            connection.sendPacket(new Presence(Presence.Type.AVAILABLE));
        }
        return connection;
    }

    public boolean isSingleton() {
View Full Code Here

            while (true) {
                IQ testIQ = new Time();
                testIQ.setType(IQ.Type.GET);
                testIQ.setTo(readerAddress);
                PacketCollector collector = con.createPacketCollector(new PacketIDFilter(testIQ.getPacketID()));
                con.sendPacket(testIQ);
                // Wait 5 seconds.
                long start = System.currentTimeMillis();
                Packet result = collector.nextResult(5000);
                collector.cancel();
                // If we got a result, continue.
View Full Code Here

            // Now start flooding packets.
            Message testMessage = new Message(readerAddress);
            testMessage.setBody("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
            while (!done) {
                con.sendPacket(testMessage);
                packetCount.getAndIncrement();
            }
        }
        catch (Exception e) {
            System.out.println("\nError: " + e.getMessage());
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.