Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.ConnectionConfiguration


    private void createConnection(){
        if (checkFields().equals("")){
            try {
            if (!txtServerIP.getText().equals("")){
                ConnectionConfiguration conConfig = new ConnectionConfiguration(txtServerIP.getText(), Integer.parseInt(txtPort.getText()));
                conConfig.setSASLAuthenticationEnabled(true);
                SASLAuthentication.supportSASLMechanism("PLAIN", 0);
                conConfig.setReconnectionAllowed(true);

                xmppconnection = new XMPPConnection(conConfig);
                xmppconnection.connect();
                blnLogin = true;
            }
View Full Code Here


     *
     * @return a new XMPP connection.
     */
    protected XMPPConnection createConnection() {
        // Create the configuration for this new connection
        ConnectionConfiguration config = new ConnectionConfiguration(host, port);
        config.setCompressionEnabled(Boolean.getBoolean("test.compressionEnabled"));
        config.setSendPresence(sendInitialPresence());
        if (getSocketFactory() == null) {
            config.setSocketFactory(getSocketFactory());
        }
        return new XMPPConnection(config);
    }
View Full Code Here

            throw new URISyntaxException(preferenceUtils.getServer(),
                "The XMPP/Jabber server address is invalid: " + serverString); //$NON-NLS-1$
        }

        ProxyInfo proxyInfo = getProxyInfo(uri.getHost());
        ConnectionConfiguration conConfig = null;

        if (uri.getPort() < 0) {
            conConfig = proxyInfo == null ? new ConnectionConfiguration(
                uri.getHost()) : new ConnectionConfiguration(uri.getHost(),
                proxyInfo);
        } else {
            conConfig = proxyInfo == null ? new ConnectionConfiguration(
                uri.getHost(), uri.getPort()) : new ConnectionConfiguration(
                uri.getHost(), uri.getPort(), proxyInfo);
        }

        /*
         * TODO It has to ask the user, if s/he wants to use non-TLS connections
         * with PLAIN SASL if TLS is not supported by the server.
         *
         * TODO use MessageDialog and Util.runSWTSync() to provide a password
         * call-back if the user has no password set in the preferences.
         */
        conConfig.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);
        /*
         * We handle reconnecting ourselves
         */
        conConfig.setReconnectionAllowed(false);

        return conConfig;
    }
View Full Code Here

        String username = preferenceUtils.getUserName();
        String password = preferenceUtils.getPassword();

        try {
            ConnectionConfiguration connectionConfiguration = this
                .getConnectionConfiguration();
            getSarosNet().connect(connectionConfiguration, username, password,
                failSilently);

        } catch (URISyntaxException e) {
View Full Code Here

    public XMPPConnection createConnection() throws XMPPException {
        XMPPConnection connection;

        if (port > 0) {
            if (getServiceName() == null) {
                connection = new XMPPConnection(new ConnectionConfiguration(host, port));
            } else {
                connection = new XMPPConnection(new ConnectionConfiguration(host, port, getServiceName()));
            }
        } else {
            connection = new XMPPConnection(host);
        }
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

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

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.