Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.ConnectionConfiguration


    }

    private XMPPConnection connectClient(String host, String user, String password, String keystorePath, String keystorePassword, final LinkedBlockingQueue<Packet> packageQueue)
            throws XMPPException {
//        ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(host, 5222);
        ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(host, 5222, "protocol7.com");
        connectionConfiguration.setKeystorePath(keystorePath);
        connectionConfiguration.setTruststorePath(keystorePath);
        connectionConfiguration.setTruststorePassword(keystorePassword);
        XMPPConnection client = new XMPPConnection(connectionConfiguration);
       
        client.connect();
        client.login(user, password);
        client.addPacketListener(new PacketListener() {
View Full Code Here


        // allow for the server to bootstrap
        Thread.sleep(200);
    }

    protected XMPPConnection connectClient(int port, String username, String password) throws Exception {
        ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration("localhost", port);
        connectionConfiguration.setCompressionEnabled(false);
        connectionConfiguration.setSecurityMode(ConnectionConfiguration.SecurityMode.required);
        connectionConfiguration.setSASLAuthenticationEnabled(true);
        connectionConfiguration.setDebuggerEnabled(false);
        connectionConfiguration.setKeystorePath("src/main/config/bogus_mina_tls.cert");
        connectionConfiguration.setTruststorePath("src/main/config/bogus_mina_tls.cert");
        connectionConfiguration.setTruststorePassword("boguspw");

        XMPPConnection.DEBUG_ENABLED = true;
        XMPPConnection client = new XMPPConnection(connectionConfiguration);

        client.connect();
View Full Code Here

        block = true;
        TestRunner.run(XmppTest.class);
    }

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

        try {
            // SmackConfiguration.setPacketReplyTimeout(1000);
View Full Code Here

        }
        LOG.info("Done!");
    }

    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");
View Full Code Here

        LOG.info("Consumer received - " + listener.getMessageCount());
    }

    public void testMultiUserChat() throws Exception {
        LOG.info("\n\n\n\n\n\n");
        ConnectionConfiguration config = new ConnectionConfiguration("localhost", 61222);
        //config.setDebuggerEnabled(true);
        //
        XMPPConnection consumerCon = new XMPPConnection(config);
        consumerCon.connect();
        consumerCon.login("consumer", "consumer");
View Full Code Here

        });
    }

    public void testTwoConnections() throws Exception {
        LOG.info("\n\n\n\n\n\n");
        ConnectionConfiguration config = new ConnectionConfiguration("localhost", 61222);
        //config.setDebuggerEnabled(true);

        //create the consumer first...
        XMPPConnection consumerCon = new XMPPConnection(config);
        consumerCon.connect();
View Full Code Here

            return connection;
        }

        if (port > 0) {
            if (getServiceName() == null) {
                connection = new XMPPConnection(new ConnectionConfiguration(host, port));
            } else {
                connection = new XMPPConnection(new ConnectionConfiguration(host, port, serviceName));
            }
        } else {
            connection = new XMPPConnection(host);
        }
View Full Code Here

            return connection;
        }

        if (port > 0) {
            if (getServiceName() == null) {
                connection = new XMPPConnection(new ConnectionConfiguration(host, port));
            } else {
                connection = new XMPPConnection(new ConnectionConfiguration(host, port, serviceName));
            }
        } else {
            connection = new XMPPConnection(host);
        }
View Full Code Here

            return connection;
        }

        if (port > 0) {
            if (getServiceName() == null) {
                connection = new XMPPConnection(new ConnectionConfiguration(host, port));
            } else {
                connection = new XMPPConnection(new ConnectionConfiguration(host, port, serviceName));
            }
        } else {
            connection = new XMPPConnection(host);
        }
View Full Code Here

        System.out.println(String.format("Initializing connection to server %1$s port %2$d", server, port));

        SmackConfiguration.setPacketReplyTimeout(packetReplyTimeout);
        if (service == null) {
            config = new ConnectionConfiguration(server, port);
        } else {
            config = new ConnectionConfiguration(server, port, service);
        }
        if (server.equalsIgnoreCase("chat.facebook.com")) {
            System.out.println("SASL Enbaled!");
            SASLAuthentication.registerSASLMechanism("DIGEST-MD5", MySASLDigestMD5Mechanism.class);
            config = new ConnectionConfiguration("chat.facebook.com", 5222);
            config.setRosterLoadedAtLogin(true);
            config.setSASLAuthenticationEnabled(true);
        } else if (server.equalsIgnoreCase("gmail.com")) {
            config = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
            config.setSASLAuthenticationEnabled(false);
        }
        if (port == -1) {
            connection = new XMPPConnection(server);
        } else {
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.ConnectionConfiguration

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.