AnsweredAssumed Answered

Unable to create a connection

Question asked by Umass on Aug 30, 2016
Latest reply on Sep 1, 2016 by Amruta

I am trying to create a connection using smack 4.1.8 as below...getting an exception..any help appreciated

 

 

import javax.net.ssl.SSLSocketFactory;

 

import org.jivesoftware.smack.AbstractXMPPConnection;

import org.jivesoftware.smack.ConnectionConfiguration;

import org.jivesoftware.smack.tcp.XMPPTCPConnection;

import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;

 

 

public class SmackClient {

    public static void main(String[] args) {

 

        try {

            // Create the configuration for this new connection

            XMPPTCPConnectionConfiguration.Builder configBuilder =

                XMPPTCPConnectionConfiguration.builder();

            configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

            configBuilder.setSocketFactory(SSLSocketFactory.getDefault());

            //configBuilder.setDebuggerEnabled(true);

            configBuilder.setSendPresence(true);

            configBuilder.setUsernameAndPassword("username",

                                                 "password");

            configBuilder.setResource("ot");

            configBuilder.setServiceName("xyz.com");

            configBuilder.setHost("stbeehive.xyz.com");

            //TLSUtils.acceptAllCertificates(configBuilder);

            configBuilder.setPort(5223);

            AbstractXMPPConnection connection =

                new XMPPTCPConnection(configBuilder.build());

            // Connect to the server

            connection.connect();

            // Log into the server

            connection.login();

            connection.disconnect();

 

        } catch (Exception e) {

            e.printStackTrace();

        }

    }

}

 

 

Exception:

 

org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Used filter: No filter used or filter was 'null'.

    at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackExceptio n.java:106)

    at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackExceptio n.java:85)

    at org.jivesoftware.smack.SynchronizationPoint.checkForResponse(SynchronizationPoi nt.java:253)

    at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWait(Synchronizatio nPoint.java:146)

    at org.jivesoftware.smack.SynchronizationPoint.checkIfSuccessOrWaitOrThrow(Synchro nizationPoint.java:125)

    at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:858)

    at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.ja va:364)

    at com.util.smack.SmackClient.main(SmackClient.java:34)

Process exited with exit code 0.

Outcomes