Package rocks.xmpp.extensions.jingle

Examples of rocks.xmpp.extensions.jingle.JingleSession


        String ibbSessionId = UUID.randomUUID().toString();
        InBandBytestreamsTransportMethod ibbTransportMethod = new InBandBytestreamsTransportMethod(ibbSessionId, 4096);

        Jingle.Content content = new Jingle.Content("a-file-offer", Jingle.Content.Creator.INITIATOR, jingleFileTransfer, ibbTransportMethod);
        final JingleSession jingleSession = jingleManager.createSession(responder, content);

        final Lock lock = new ReentrantLock();
        final Condition condition = lock.newCondition();
        final Jingle[] response = new Jingle[1];

        jingleSession.addJingleListener(new JingleListener() {
            @Override
            public void jingleReceived(JingleEvent e) {
                if (e.getJingle().getAction() == Jingle.Action.SESSION_ACCEPT || e.getJingle().getAction() == Jingle.Action.SESSION_TERMINATE) {
                    lock.lock();
                    try {
                        response[0] = e.getJingle();
                        condition.signalAll();
                    } finally {
                        lock.unlock();
                    }
                }
            }
        });
        jingleSession.initiate();

        // Wait until the session is either accepted or declined (terminated).
        lock.lock();
        try {
            if (!condition.await(timeout, TimeUnit.MILLISECONDS)) {
View Full Code Here

TOP

Related Classes of rocks.xmpp.extensions.jingle.JingleSession

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.