Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.ConnectionConfiguration


        // 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


        // 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

        this.resource = resource;
    }

    @Override
    public void afterPropertiesSet() throws XMPPException {
        ConnectionConfiguration configuration = createConnectionConfiguration(host, port, serviceName);
        Assert.notNull(configuration, "'configuration' must not be null");
        Assert.hasText(username, "'username' must not be empty");
        Assert.hasText(password, "'password' must not be empty");

        connection = new XMPPConnection(configuration);
View Full Code Here

     * @param serviceName the name of the service to connect to. May be {@code null}
     */
    protected ConnectionConfiguration createConnectionConfiguration(String host, int port, String serviceName) {
        Assert.hasText(host, "'host' must not be empty");
        if (StringUtils.hasText(serviceName)) {
            return new ConnectionConfiguration(host, port, serviceName);
        }
        else {
            return new ConnectionConfiguration(host, port);
        }
    }
View Full Code Here

    for (String s: to.split(";")) {
      if (s != null && !"".equals(s)) {
        this.toUsers.add(s);
      }
    }
        ConnectionConfiguration conf = new ConnectionConfiguration(server, port , service);
        XMPPConnection connection = null;
        try {

           if(server !=null && !server.equals("") && port != 0){
             connection = new XMPPConnection(conf);
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

    }



    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



    public void testMultiUserChat() throws Exception {
        System.out.println("\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 {
        System.out.println("\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

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.