Search in sources :

Example 1 with STUNTransportManager

use of org.jivesoftware.smackx.jingle.nat.STUNTransportManager in project Smack by igniterealtime.

the class JingleMediaTest method testCompleteSpeex.

public void testCompleteSpeex() {
    try {
        //SmackConfiguration.DEBUG = true;
        XMPPTCPConnection x0 = getConnection(0);
        XMPPTCPConnection x1 = getConnection(1);
        JingleMediaManager jingleMediaManager0 = new SpeexMediaManager(new STUNTransportManager());
        JingleMediaManager jingleMediaManager1 = new SpeexMediaManager(new STUNTransportManager());
        List<JingleMediaManager> jml0 = new ArrayList<JingleMediaManager>();
        List<JingleMediaManager> jml1 = new ArrayList<JingleMediaManager>();
        jml0.add(jingleMediaManager0);
        jml1.add(jingleMediaManager1);
        final JingleManager jm0 = new JingleManager(x0, jml0);
        final JingleManager jm1 = new JingleManager(x1, jml1);
        jm1.addJingleSessionRequestListener(new JingleSessionRequestListener() {

            public void sessionRequested(final JingleSessionRequest request) {
                try {
                    JingleSession session = request.accept();
                    session.startIncoming();
                } catch (XMPPException e) {
                    LOGGER.log(Level.WARNING, "exception", e);
                }
            }
        });
        JingleSession js0 = jm0.createOutgoingJingleSession(x1.getUser());
        js0.startOutgoing();
        Thread.sleep(150000);
        js0.terminate();
        Thread.sleep(6000);
        x0.disconnect();
        x1.disconnect();
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "exception", e);
    }
}
Also used : JingleMediaManager(org.jivesoftware.smackx.jingle.media.JingleMediaManager) ArrayList(java.util.ArrayList) SpeexMediaManager(org.jivesoftware.smackx.jingle.mediaimpl.jspeex.SpeexMediaManager) XMPPException(org.jivesoftware.smack.XMPPException) JingleSessionRequestListener(org.jivesoftware.smackx.jingle.listeners.JingleSessionRequestListener) XMPPException(org.jivesoftware.smack.XMPPException) STUNTransportManager(org.jivesoftware.smackx.jingle.nat.STUNTransportManager)

Aggregations

ArrayList (java.util.ArrayList)1 XMPPException (org.jivesoftware.smack.XMPPException)1 JingleSessionRequestListener (org.jivesoftware.smackx.jingle.listeners.JingleSessionRequestListener)1 JingleMediaManager (org.jivesoftware.smackx.jingle.media.JingleMediaManager)1 SpeexMediaManager (org.jivesoftware.smackx.jingle.mediaimpl.jspeex.SpeexMediaManager)1 STUNTransportManager (org.jivesoftware.smackx.jingle.nat.STUNTransportManager)1