Java Code Examples for org.jivesoftware.smack.SmackConfiguration#DEBUG
The following examples show how to use
org.jivesoftware.smack.SmackConfiguration#DEBUG .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmppMessageEngine.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
/** * Constructor for the XMPP message engine. It initialises fields and a {@link java.util.Timer Timer} that periodically * in interval that is randomly set, executes the {@link #renewPresenceAndRoster() renewPresenceAndRoster} method. * * @param objectId String with the object ID that connects via this engine. * @param password Password string for authentication. * @param config Configuration of the OGWAPI. * @param logger Logger of the OGWAPI. * @param connectionDescriptor Connection descriptor that is using this particular instance of engine. */ public XmppMessageEngine(String objectId, String password, XMLConfiguration config, Logger logger, ConnectionDescriptor connectionDescriptor) { super(objectId, password, config, logger, connectionDescriptor); connection = null; chatManager = null; roster = null; // initialise map with opened chats openedChats = new HashMap<EntityBareJid, Chat>(); // compute the random time in seconds after which a roster will be renewed long timeForRosterRenewal = (long) ((Math.random() * ((ROSTER_RELOAD_TIME_MAX - ROSTER_RELOAD_TIME_MIN) + 1)) + ROSTER_RELOAD_TIME_MIN) * 1000; logger.finest("The roster for " + objectId + " will be renewed every " + timeForRosterRenewal + "ms."); // timer for roster renewing Timer timerForRosterRenewal = new Timer(); timerForRosterRenewal.schedule(new TimerTask() { @Override public void run() { renewPresenceAndRoster(); } }, timeForRosterRenewal, timeForRosterRenewal); // enable debugging if desired boolean debuggingEnabled = config.getBoolean(CONFIG_PARAM_XMPPDEBUG, CONFIG_DEF_XMPPDEBUG); if (debuggingEnabled) { SmackConfiguration.DEBUG = debuggingEnabled; logger.config("XMPP debugging enabled."); } }
Example 2
Source File: XMPPManager.java From Yahala-Messenger with MIT License | 5 votes |
public XMPPManager(String server, int port) { // SmackAndroid.init(ApplicationLoader.applicationContext); // SmackConfiguration.setDefaultPacketReplyTimeout(packetReplyTimeout); SmackConfiguration.setDefaultPacketReplyTimeout(20 * 300); SmackConfiguration.DEBUG = true; // createAlarm(); //mServiceLooper = Looper.getMainLooper(); this.HOST = server; this.PORT = port; //mReconnectHandler = new Handler(mServiceLooper); }
Example 3
Source File: XMPPManager.java From Yahala-Messenger with MIT License | 5 votes |
public XMPPManager() { //SmackAndroid.init(ApplicationLoader.applicationContext); //SmackConfiguration.setDefaultPacketReplyTimeout(packetReplyTimeout); SmackConfiguration.setDefaultPacketReplyTimeout(20 * 300); SmackConfiguration.DEBUG = true; createAlarm(); // mReconnectHandler = new Handler(mServiceLooper); }
Example 4
Source File: OmemoClient.java From Smack with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws XMPPException, SmackException, IOException, InterruptedException, CorruptedOmemoKeyException { SmackConfiguration.DEBUG = true; if (args.length != 2) { print("Missing arguments: <jid> <password>"); return; } SignalOmemoService.acknowledgeLicense(); SignalOmemoService.setup(); SignalOmemoService omemoService = (SignalOmemoService) SignalOmemoService.getInstance(); Path omemoStoreDirectory = Files.createTempDirectory("omemo-store"); omemoService.setOmemoStoreBackend(new SignalCachingOmemoStore(new SignalFileBasedOmemoStore(omemoStoreDirectory.toFile()))); EntityBareJid jid = JidCreate.entityBareFromOrThrowUnchecked(args[0]); String password = args[1]; OmemoClient client = new OmemoClient(jid, password); try { client.start(); while (true) { String input = scanner.nextLine(); if (input.startsWith("/quit")) { break; } if (input.isEmpty()) { continue; } client.handleInput(input); } } finally { client.stop(); } }
Example 5
Source File: SLF4JSmackDebugger.java From Smack with Apache License 2.0 | 4 votes |
/** * Makes Smack use this Debugger. */ public static void enable() { SmackConfiguration.DEBUG = true; SmackConfiguration.setDefaultSmackDebuggerFactory(SLF4JDebuggerFactory.INSTANCE); }
Example 6
Source File: SmackIntegrationTestFramework.java From Smack with Apache License 2.0 | 4 votes |
public synchronized TestRunResult run() throws KeyManagementException, NoSuchAlgorithmException, SmackException, IOException, XMPPException, InterruptedException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { // The DNS resolver is not really a per sinttest run setting. It is not even a per connection setting. Instead // it is a global setting, but we treat it like a per sinttest run setting. switch (config.dnsResolver) { case minidns: MiniDnsResolver.setup(); break; case javax: JavaxResolver.setup(); break; case dnsjava: DNSJavaResolver.setup(); break; } testRunResult = new TestRunResult(); // Create a connection manager *after* we created the testRunId (in testRunResult). this.connectionManager = new XmppConnectionManager(this); LOGGER.info("SmackIntegrationTestFramework [" + testRunResult.testRunId + ']' + ": Starting\nSmack version: " + SmackConfiguration.getVersion()); if (config.debugger != Configuration.Debugger.none) { // JUL Debugger will not print any information until configured to print log messages of // level FINE // TODO configure JUL for log? SmackConfiguration.addDisabledSmackClass("org.jivesoftware.smack.debugger.JulDebugger"); SmackConfiguration.DEBUG = true; } if (config.replyTimeout > 0) { SmackConfiguration.setDefaultReplyTimeout(config.replyTimeout); } if (config.securityMode != SecurityMode.required && config.accountRegistration == AccountRegistration.inBandRegistration) { AccountManager.sensitiveOperationOverInsecureConnectionDefault(true); } // TODO print effective configuration String[] testPackages; if (config.testPackages == null || config.testPackages.isEmpty()) { testPackages = new String[] { "org.jivesoftware.smackx", "org.jivesoftware.smack" }; } else { testPackages = config.testPackages.toArray(new String[config.testPackages.size()]); } Reflections reflections = new Reflections(testPackages, new SubTypesScanner(), new TypeAnnotationsScanner(), new MethodAnnotationsScanner(), new MethodParameterScanner()); Set<Class<? extends AbstractSmackIntegrationTest>> inttestClasses = reflections.getSubTypesOf(AbstractSmackIntegrationTest.class); Set<Class<? extends AbstractSmackLowLevelIntegrationTest>> lowLevelInttestClasses = reflections.getSubTypesOf(AbstractSmackLowLevelIntegrationTest.class); Set<Class<? extends AbstractSmackIntTest>> classes = new HashSet<>(inttestClasses.size() + lowLevelInttestClasses.size()); classes.addAll(inttestClasses); classes.addAll(lowLevelInttestClasses); { // Remove all abstract classes. // TODO: This may be a good candidate for Java stream filtering once Smack is Android API 24 or higher. Iterator<Class<? extends AbstractSmackIntTest>> it = classes.iterator(); while (it.hasNext()) { Class<? extends AbstractSmackIntTest> clazz = it.next(); if (Modifier.isAbstract(clazz.getModifiers())) { it.remove(); } } } if (classes.isEmpty()) { throw new IllegalStateException("No test classes found"); } LOGGER.info("SmackIntegrationTestFramework [" + testRunResult.testRunId + "]: Finished scanning for tests, preparing environment"); environment = prepareEnvironment(); try { runTests(classes); } catch (Throwable t) { // Log the thrown Throwable to prevent it being shadowed in case the finally block below also throws. LOGGER.log(Level.SEVERE, "Unexpected abort because runTests() threw throwable", t); throw t; } finally { // Ensure that the accounts are deleted and disconnected before we continue connectionManager.disconnectAndCleanup(); } return testRunResult; }
Example 7
Source File: DoX.java From Smack with Apache License 2.0 | 4 votes |
public static void main(String[] args) throws XMPPException, SmackException, IOException, InterruptedException { SmackConfiguration.DEBUG = true; XMPPTCPConnection connection = new XMPPTCPConnection(args[0], args[1]); connection.setReplyTimeout(60000); connection.connect().login(); DnsOverXmppManager dox = DnsOverXmppManager.getInstanceFor(connection); Jid target = JidCreate.from("[email protected]/listener"); Question question = new Question("geekplace.eu", Record.TYPE.A); DnsMessage response = dox.query(target, question); // CHECKSTYLE:OFF System.out.println(response); // CHECKSTYLE:ON connection.disconnect(); }