Package org.jivesoftware.smack

Examples of org.jivesoftware.smack.ConnectionConfiguration


    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


   * @return a reused connection configuration for connecting to the im server
   */
  protected static ConnectionConfiguration getConnectionConfiguration() {
    if (connConfig == null) {
      // 5222 is the default unsecured jabber server port
      connConfig = new ConnectionConfiguration(InstantMessagingModule.getAdapter().getConfig().getServername(), 5222);
      connConfig.setNotMatchingDomainCheckEnabled(false);
      connConfig.setSASLAuthenticationEnabled(false);
      connConfig.setReconnectionAllowed(false);
    }
    return connConfig;
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    ConnectionConfiguration connConfig = new ConnectionConfiguration("idlnxgs.unizh.ch", 5222);
    connConfig.setNotMatchingDomainCheckEnabled(false);
    connConfig.setSASLAuthenticationEnabled(false);
    connConfig.setReconnectionAllowed(false);
    connConfig.setDebuggerEnabled(true);

    ProviderManager providerMgr = ProviderManager.getInstance();
    providerMgr.addIQProvider("query", UserCreate.NAMESPACE, new UserCreate.Provider());
    providerMgr.addIQProvider("query", UserDelete.NAMESPACE, new UserCreate.Provider());
   
View Full Code Here

    }
  }

  private void connect(String servername, String adminUsername, String adminPassword, String nodeId) {
    try {
      ConnectionConfiguration conConfig = new ConnectionConfiguration(servername, 5222);
      conConfig.setNotMatchingDomainCheckEnabled(false);
      conConfig.setSASLAuthenticationEnabled(false);
      //the admin reconnects automatically upon server restart or failure but *not* on a resource conflict and a manual close of the connection
      conConfig.setReconnectionAllowed(true);
      //conConfig.setDebuggerEnabled(true);
      if (connection == null || !connection.isAuthenticated()) {
        connection = new XMPPConnection(conConfig);
        connection.connect();
        connection.addConnectionListener(new ConnectionListener() {
View Full Code Here

                if (config.getServletConfig().getInitParameter(XMPP_DEBUG) != null) {
                    XMPPConnection.DEBUG_ENABLED = true;
                }              
            }

            ConnectionConfiguration config = null;
            int port = -1;
            try {
                port = uri.getPort();
            } catch (Throwable t) {
                ;
            }
            if (port == -1) {
                config = new ConnectionConfiguration(uri.getHost());
            } else {
                config = new ConnectionConfiguration(uri.getHost(), port);

            }

            xmppConnection = new XMPPConnection(config);
            xmppConnection.connect();
View Full Code Here

                if (config.getServletConfig().getInitParameter(XMPP_DEBUG) != null) {
                    XMPPConnection.DEBUG_ENABLED = true;
                }
            }

            ConnectionConfiguration config = null;
            int port = -1;
            try {
                port = uri.getPort();
            } catch (Throwable t) {
                ;
            }
            if (port == -1) {
                config = new ConnectionConfiguration(uri.getHost());
            } else {
                config = new ConnectionConfiguration(uri.getHost(), port);

            }

            xmppConnection = new XMPPConnection(config);
            xmppConnection.connect();
View Full Code Here

    // Implementation methods
    // -------------------------------------------------------------------------
    protected XMPPConnection createConnection() throws XMPPException {
        XMPPConnection connection;
        if (port > 0) {
            connection = new XMPPConnection(new ConnectionConfiguration(host, port));
        } else {
            connection = new XMPPConnection(host);
        }

        connection.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);
       
        XMPPConnection.DEBUG_ENABLED = true;
        XMPPConnection client = new XMPPConnection(connectionConfiguration);
       
        client.connect();
View Full Code Here

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

        String me = args.length > 0 ? args[0] : "user1";
        String to = args.length < 2 ? null : args[1];

        try {
            ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration("localhost");
            //            ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration("xmpp.eu");
            connectionConfiguration.setCompressionEnabled(false);
            connectionConfiguration.setSelfSignedCertificateEnabled(true);
            connectionConfiguration.setExpiredCertificatesCheckEnabled(false);
            connectionConfiguration.setDebuggerEnabled(true);
            connectionConfiguration.setSASLAuthenticationEnabled(true);
            connectionConfiguration.setSecurityMode(ConnectionConfiguration.SecurityMode.required);
            XMPPConnection.DEBUG_ENABLED = true;
            XMPPConnection connection = new XMPPConnection(connectionConfiguration);
            connection.connect();

            SASLAuthentication saslAuthentication = connection.getSASLAuthentication();
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.