mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 22:32:06 +01:00
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7104 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
858b84d912
commit
ed660f73e9
5 changed files with 132 additions and 97 deletions
|
@ -1,5 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4" relativePaths="true" type="JAVA_MODULE">
|
||||
<component name="BuildJarSettings">
|
||||
<containerInfo>
|
||||
<containerElement type="module" name="JingleExtension">
|
||||
<attribute name="method" value="1" />
|
||||
<attribute name="URI" value="/" />
|
||||
</containerElement>
|
||||
</containerInfo>
|
||||
<setting name="jarUrl" value="file://$MODULE_DIR$/../../JingleExtension.jar" />
|
||||
<setting name="buildJar" value="true" />
|
||||
<setting name="mainClass" value="" />
|
||||
</component>
|
||||
<component name="ModuleRootManager" />
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/../../classes" />
|
||||
|
@ -30,6 +41,7 @@
|
|||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module" module-name="Smack" />
|
||||
<orderEntry type="module" module-name="JingleMedia" />
|
||||
<orderEntryProperties />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
|
|
|
@ -49,34 +49,34 @@ import java.util.List;
|
|||
* Jingle is a session establishment protocol defined in (XEP-0166).
|
||||
* It defines a framework for negotiating and managing out-of-band ( data that is send and receive through other connection than XMPP connection) data sessions over XMPP.
|
||||
* With this protocol you can setup VOIP Calls, Video Streaming, File transfers and whatever out-of-band session based transmission.
|
||||
*
|
||||
* <p/>
|
||||
* To create a Jingle Session you need a Transport method and a Payload type.
|
||||
*
|
||||
* <p/>
|
||||
* A transport method is how it will trasmit and receive network packets. Transport MUST have one or more candidates.
|
||||
* A transport candidate is an IP Address with a defined port, that other party must send data to.
|
||||
*
|
||||
* <p/>
|
||||
* A supported payload type, is the data encoding format that the jmf will be transmitted.
|
||||
* For instance an Audio Payload "GSM".
|
||||
*
|
||||
* <p/>
|
||||
* A Jingle session negociates a payload type and a pair of transport candidates.
|
||||
* Which means that when a Jingle Session is establhished you will have two defined transport candidates with addresses
|
||||
* and a defined Payload type.
|
||||
* In other words, you will have two IP address with their respective ports, and a Codec type defined.
|
||||
*
|
||||
* <p/>
|
||||
* The JingleManager is a facade built upon Jabber Jingle (XEP-166) to allow the
|
||||
* use of Jingle. This implementation allows the user to simply
|
||||
* use this class for setting the Jingle parameters, create and receive Jingle Sessions.
|
||||
*
|
||||
* <p/>
|
||||
* In order to use the Jingle, the user must provide a
|
||||
* TransportManager that will handle the resolution of potential IP addresses taht can be used to transport the streaming (jmf).
|
||||
* This TransportManager can be initialized with several default resolvers,
|
||||
* including a fixed solver that can be used when the address and port are know
|
||||
* in advance.
|
||||
* This API have ready to use Transport Managers, for instance: BasicTransportManager, STUNTransportManager, BridgedTransportManager.
|
||||
*
|
||||
* <p/>
|
||||
* You should also especify a JingleMediaManager if you want that JingleManager assume Media control
|
||||
* Using a JingleMediaManager implementation is the easier way to implement a Jingle Application.
|
||||
*
|
||||
* <p/>
|
||||
* Otherwise before creating an outgoing connection, the user must create jingle session
|
||||
* listeners that will be called when different events happen. The most
|
||||
* important event is <i>sessionEstablished()</i>, that will be called when all
|
||||
|
@ -84,85 +84,85 @@ import java.util.List;
|
|||
* transmission as well as the remote and local addresses and ports for the
|
||||
* communication. See JingleSessionListener for a complete list of events that can be
|
||||
* observed.
|
||||
*
|
||||
* <p/>
|
||||
* This is an example of how to use the JingleManager:
|
||||
* <i>This example implements a Jingle VOIP Call between two users.</i>
|
||||
*
|
||||
* <p/>
|
||||
* <pre>
|
||||
*
|
||||
* <p/>
|
||||
* To wait for an Incoming Jingle Session:
|
||||
*
|
||||
* <p/>
|
||||
* try {
|
||||
*
|
||||
* <p/>
|
||||
* // Connect to a XMPP Server
|
||||
* XMPPConnection x1 = new XMPPConnection("xmpp.com");
|
||||
* x1.connect();
|
||||
* x1.login("juliet", "juliet");
|
||||
*
|
||||
* <p/>
|
||||
* // Create a JingleManager using a BasicResolver
|
||||
* final JingleManager jm1 = new JingleManager(
|
||||
* x1, new BasicTransportManager());
|
||||
*
|
||||
* <p/>
|
||||
* // Create a JingleMediaManager. In this case using Jingle Audio Media API
|
||||
* JingleMediaManager jingleMediaManager = new AudioMediaManager();
|
||||
*
|
||||
* <p/>
|
||||
* // Set the JingleMediaManager
|
||||
* jm1.setMediaManager(jingleMediaManager);
|
||||
*
|
||||
* <p/>
|
||||
* // Listen for incoming calls
|
||||
* jm1.addJingleSessionRequestListener(new JingleSessionRequestListener() {
|
||||
* public void sessionRequested(JingleSessionRequest request) {
|
||||
*
|
||||
* <p/>
|
||||
* try {
|
||||
* // Accept the call
|
||||
* IncomingJingleSession session = request.accept();
|
||||
*
|
||||
*
|
||||
* <p/>
|
||||
* <p/>
|
||||
* // Start the call
|
||||
* session.start();
|
||||
* } catch (XMPPException e) {
|
||||
* e.printStackTrace();
|
||||
* }
|
||||
*
|
||||
* <p/>
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* <p/>
|
||||
* Thread.sleep(15000);
|
||||
*
|
||||
* <p/>
|
||||
* } catch (Exception e) {
|
||||
* e.printStackTrace();
|
||||
* }
|
||||
*
|
||||
* <p/>
|
||||
* To create an Outgoing Jingle Session:
|
||||
*
|
||||
* <p/>
|
||||
* try {
|
||||
*
|
||||
* <p/>
|
||||
* // Connect to a XMPP Server
|
||||
* XMPPConnection x0 = new XMPPConnection("xmpp.com");
|
||||
* x0.connect();
|
||||
* x0.login("romeo", "romeo");
|
||||
*
|
||||
* <p/>
|
||||
* // Create a JingleManager using a BasicResolver
|
||||
* final JingleManager jm0 = new JingleManager(
|
||||
* x0, new BasicTransportManager());
|
||||
*
|
||||
* <p/>
|
||||
* // Create a JingleMediaManager. In this case using Jingle Audio Media API
|
||||
* JingleMediaManager jingleMediaManager = new AudioMediaManager(); // Using Jingle Media API
|
||||
*
|
||||
* <p/>
|
||||
* // Set the JingleMediaManager
|
||||
* jm0.setMediaManager(jingleMediaManager);
|
||||
*
|
||||
* <p/>
|
||||
* // Create a new Jingle Call with a full JID
|
||||
* OutgoingJingleSession js0 = jm0.createOutgoingJingleSession("juliet@xmpp.com/Smack");
|
||||
*
|
||||
* <p/>
|
||||
* // Start the call
|
||||
* js0.start();
|
||||
*
|
||||
* <p/>
|
||||
* Thread.sleep(10000);
|
||||
* js0.terminate();
|
||||
*
|
||||
* <p/>
|
||||
* Thread.sleep(3000);
|
||||
*
|
||||
* <p/>
|
||||
* } catch (Exception e) {
|
||||
* e.printStackTrace();
|
||||
* }
|
||||
|
@ -275,7 +275,8 @@ public class JingleManager implements JingleSessionListener {
|
|||
if (aux != null)
|
||||
try {
|
||||
aux.terminate();
|
||||
} catch (XMPPException e) {
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -323,8 +324,8 @@ public class JingleManager implements JingleSessionListener {
|
|||
|
||||
/**
|
||||
* Enables or disables the Jingle support on a given connection.
|
||||
*
|
||||
*
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Before starting any Jingle jmf session, check that the user can handle
|
||||
* it. Enable the Jingle support to indicate that this client handles Jingle
|
||||
* messages.
|
||||
|
@ -334,7 +335,7 @@ public class JingleManager implements JingleSessionListener {
|
|||
* @param enabled indicates if the service will be enabled or disabled
|
||||
*/
|
||||
public synchronized static void setServiceEnabled(XMPPConnection connection,
|
||||
boolean enabled) {
|
||||
boolean enabled) {
|
||||
if (isServiceEnabled(connection) == enabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -342,7 +343,8 @@ public class JingleManager implements JingleSessionListener {
|
|||
if (enabled) {
|
||||
ServiceDiscoveryManager.getInstanceFor(connection).addFeature(
|
||||
Jingle.NAMESPACE);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ServiceDiscoveryManager.getInstanceFor(connection).removeFeature(
|
||||
Jingle.NAMESPACE);
|
||||
}
|
||||
|
@ -475,7 +477,8 @@ public class JingleManager implements JingleSessionListener {
|
|||
for (CreatedJingleSessionListener createdJingleSessionListener : creationListeners) {
|
||||
try {
|
||||
createdJingleSessionListener.sessionCreated(jingleSession);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -549,7 +552,8 @@ public class JingleManager implements JingleSessionListener {
|
|||
for (JingleSession jingleSession : sessions)
|
||||
try {
|
||||
jingleSession.terminate();
|
||||
} catch (XMPPException e) {
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -589,7 +593,7 @@ public class JingleManager implements JingleSessionListener {
|
|||
* @return The session on which the negotiation can be run.
|
||||
*/
|
||||
public OutgoingJingleSession createOutgoingJingleSession(String responder,
|
||||
List<PayloadType> payloadTypes) throws XMPPException {
|
||||
List<PayloadType> payloadTypes) throws XMPPException {
|
||||
|
||||
if (responder == null || StringUtils.parseName(responder).length() <= 0
|
||||
|| StringUtils.parseServer(responder).length() <= 0
|
||||
|
@ -666,8 +670,10 @@ public class JingleManager implements JingleSessionListener {
|
|||
if (request == null) {
|
||||
throw new NullPointerException("JingleMediaManager is not defined");
|
||||
}
|
||||
if (jingleMediaManager == null) return null;
|
||||
return createIncomingJingleSession(request, jingleMediaManager.getPayloads());
|
||||
if (jingleMediaManager != null)
|
||||
return createIncomingJingleSession(request, jingleMediaManager.getPayloads());
|
||||
|
||||
return createIncomingJingleSession(request,null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -682,7 +688,8 @@ public class JingleManager implements JingleSessionListener {
|
|||
if (jingleSession.getResponder().equals(jid)) {
|
||||
return jingleSession;
|
||||
}
|
||||
} else if (jingleSession instanceof IncomingJingleSession) {
|
||||
}
|
||||
else if (jingleSession instanceof IncomingJingleSession) {
|
||||
if (jingleSession.getInitiator().equals(jid)) {
|
||||
return jingleSession;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
|
||||
static int ccc = 0;
|
||||
|
||||
private boolean closed = false;
|
||||
private boolean closed = false;
|
||||
|
||||
/**
|
||||
* Full featured JingleSession constructor
|
||||
|
@ -343,6 +343,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
public IQ dispatchIncomingPacket(IQ iq, String id) throws XMPPException {
|
||||
IQ jout = null;
|
||||
|
||||
if (iq != null) System.out.println("L: " + iq.toXML());
|
||||
|
||||
if (invalidState()) {
|
||||
throw new IllegalStateException(
|
||||
"Illegal state in dispatch packet in Session manager.");
|
||||
|
@ -377,12 +379,16 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
jout = getState().eventInfo(jin);
|
||||
}
|
||||
else if (action.equals(Jingle.Action.SESSIONINITIATE)) {
|
||||
jout = getState().eventInitiate(jin);
|
||||
if (getState() != null)
|
||||
jout = getState().eventInitiate(jin);
|
||||
}
|
||||
else if (action.equals(Jingle.Action.SESSIONREDIRECT)) {
|
||||
jout = getState().eventRedirect(jin);
|
||||
}
|
||||
else if (action.equals(Jingle.Action.SESSIONTERMINATE)) {
|
||||
|
||||
System.out.println("SESSION PACKET");
|
||||
|
||||
jout = getState().eventTerminate(jin);
|
||||
}
|
||||
}
|
||||
|
@ -417,6 +423,9 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
public synchronized IQ respond(IQ iq) throws XMPPException {
|
||||
IQ response = null;
|
||||
|
||||
if (iq != null)
|
||||
System.out.println("TT: " + iq.toXML());
|
||||
|
||||
if (isValid()) {
|
||||
String responseId = null;
|
||||
IQ sessionResponse = null;
|
||||
|
@ -887,10 +896,10 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
if (iq instanceof Jingle) {
|
||||
Jingle jin = (Jingle) iq;
|
||||
|
||||
//System.out.println("Jingle: " + iq.toXML());
|
||||
System.out.println("Jingle: " + iq.toXML());
|
||||
|
||||
String sid = jin.getSid();
|
||||
if (!sid.equals(getSid())) {
|
||||
if (sid == null || !sid.equals(getSid())) {
|
||||
System.out.println("Ignored Jingle(SID) " + sid + "|" + getSid() + " :" + iq.toXML());
|
||||
return false;
|
||||
}
|
||||
|
@ -1091,8 +1100,8 @@ public abstract class JingleSession extends JingleNegotiator {
|
|||
destroyMediaNeg();
|
||||
destroyTransportNeg();
|
||||
removePacketListener();
|
||||
System.out.println("Negociation Closed");
|
||||
closed=true;
|
||||
System.out.println("Negociation Closed: "+getConnection().getUser());
|
||||
closed = true;
|
||||
super.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,9 @@ public class JingleSessionRequest {
|
|||
pts);
|
||||
session.setInitialSessionRequest(this);
|
||||
// Acknowledge the IQ reception
|
||||
session.sendAck(this.getJingle());
|
||||
session.setSid(this.getSessionID());
|
||||
//session.sendAck(this.getJingle());
|
||||
//session.respond(this.getJingle());
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
@ -93,6 +95,11 @@ public class JingleSessionRequest {
|
|||
synchronized (manager) {
|
||||
session = manager.createIncomingJingleSession(this);
|
||||
session.setInitialSessionRequest(this);
|
||||
// Acknowledge the IQ reception
|
||||
session.setSid(this.getSessionID());
|
||||
//session.sendAck(this.getJingle());
|
||||
//session.updatePacketListener();
|
||||
//session.respond(this.getJingle());
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ import org.jivesoftware.smackx.jingle.media.PayloadType;
|
|||
import org.jivesoftware.smackx.jingle.nat.*;
|
||||
import org.jivesoftware.smackx.packet.Jingle;
|
||||
import org.jivesoftware.smackx.provider.JingleProvider;
|
||||
import org.jivesoftware.jingleaudio.jmf.JmfMediaManager;
|
||||
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
|
@ -361,7 +362,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
}
|
||||
|
||||
public void sessionEstablished(PayloadType pt,
|
||||
TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
|
||||
TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
|
||||
incCounter();
|
||||
System.out
|
||||
.println("Responder: the session is fully established.");
|
||||
|
@ -441,7 +442,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
}
|
||||
|
||||
public void sessionEstablished(PayloadType pt,
|
||||
TransportCandidate rc, final TransportCandidate lc, JingleSession jingleSession) {
|
||||
TransportCandidate rc, final TransportCandidate lc, JingleSession jingleSession) {
|
||||
incCounter();
|
||||
System.out
|
||||
.println("Responder: the session is fully established.");
|
||||
|
@ -481,7 +482,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
}
|
||||
|
||||
public void sessionEstablished(PayloadType pt,
|
||||
TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
|
||||
TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
|
||||
incCounter();
|
||||
System.out.println("Initiator: the session is fully established.");
|
||||
System.out.println("+ Payload Type: " + pt.getId());
|
||||
|
@ -515,8 +516,8 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
resetCounter();
|
||||
|
||||
try {
|
||||
TransportResolver tr1 = new FixedResolver("127.0.0.1", 54222);
|
||||
TransportResolver tr2 = new FixedResolver("127.0.0.1", 54567);
|
||||
TransportResolver tr1 = new FixedResolver("127.0.0.1", 22222);
|
||||
TransportResolver tr2 = new FixedResolver("127.0.0.1", 22444);
|
||||
|
||||
final JingleManager man0 = new JingleManager(getConnection(0), tr1);
|
||||
final JingleManager man1 = new JingleManager(getConnection(1), tr2);
|
||||
|
@ -527,16 +528,16 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
*/
|
||||
public void sessionRequested(final JingleSessionRequest request) {
|
||||
System.out.println("Session request detected, from "
|
||||
+ request.getFrom() + ": rejecting.");
|
||||
+ request.getFrom());
|
||||
|
||||
// We reject the request
|
||||
try {
|
||||
IncomingJingleSession session = request.accept(null);
|
||||
IncomingJingleSession session = request.accept(getTestPayloads1());
|
||||
session.setInitialSessionRequest(request);
|
||||
session.start();
|
||||
session.terminate();
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -549,6 +550,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
|
||||
session0.addListener(new JingleSessionListener() {
|
||||
public void sessionClosed(String reason, JingleSession jingleSession) {
|
||||
System.out.println("The session has been closed");
|
||||
}
|
||||
|
||||
public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
|
||||
|
@ -562,7 +564,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
}
|
||||
|
||||
public void sessionEstablished(PayloadType pt,
|
||||
TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
|
||||
TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
|
||||
}
|
||||
|
||||
public void sessionRedirected(String redirection, JingleSession jingleSession) {
|
||||
|
@ -571,6 +573,10 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
|
||||
session0.start();
|
||||
|
||||
Thread.sleep(50000);
|
||||
|
||||
session0.terminate();
|
||||
|
||||
Thread.sleep(10000);
|
||||
|
||||
assertTrue(valCounter() > 0);
|
||||
|
@ -594,13 +600,10 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
ProviderManager.getInstance().addIQProvider(RTPBridge.NAME,
|
||||
RTPBridge.NAMESPACE, new RTPBridge.Provider());
|
||||
|
||||
XMPPConnection x2 = new XMPPConnection("thiago");
|
||||
x2.connect();
|
||||
x2.login("barata6", "barata6");
|
||||
|
||||
RTPBridge response = RTPBridge.getRTPBridge(x2, "102");
|
||||
RTPBridge response = RTPBridge.getRTPBridge(getConnection(0), "102");
|
||||
|
||||
class Listener implements Runnable {
|
||||
|
||||
private byte[] buf = new byte[5000];
|
||||
private DatagramSocket dataSocket;
|
||||
private DatagramPacket packet;
|
||||
|
@ -617,7 +620,8 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
dataSocket.receive(packet);
|
||||
incCounter();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -660,14 +664,18 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
ds0.close();
|
||||
ds1.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -683,13 +691,8 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
|
||||
XMPPConnection.DEBUG_ENABLED = true;
|
||||
|
||||
XMPPConnection x0 = new XMPPConnection("thiago");
|
||||
XMPPConnection x1 = new XMPPConnection("thiago");
|
||||
|
||||
x0.connect();
|
||||
x0.login("barata7", "barata7");
|
||||
x1.connect();
|
||||
x1.login("barata6", "barata6");
|
||||
XMPPConnection x0 = getConnection(0);
|
||||
XMPPConnection x1 = getConnection(1);
|
||||
|
||||
final JingleManager jm0 = new JingleManager(
|
||||
x0, new STUNResolver() {
|
||||
|
@ -765,14 +768,15 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
});
|
||||
|
||||
session.start();
|
||||
} catch (XMPPException e) {
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
OutgoingJingleSession js0 = jm0.createOutgoingJingleSession("barata6@thiago/Smack");
|
||||
OutgoingJingleSession js0 = jm0.createOutgoingJingleSession(x1.getUser());
|
||||
|
||||
js0.addListener(new JingleSessionListener() {
|
||||
|
||||
|
@ -807,7 +811,8 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
assertTrue(valCounter() == 2);
|
||||
//Thread.sleep(15000);
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -824,23 +829,16 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
|
||||
//XMPPConnection.DEBUG_ENABLED = true;
|
||||
|
||||
XMPPConnection x0 = new XMPPConnection("thiago");
|
||||
XMPPConnection x1 = new XMPPConnection("thiago");
|
||||
|
||||
x0.connect();
|
||||
x0.login("barata7", "barata7");
|
||||
x1.connect();
|
||||
x1.login("barata6", "barata6");
|
||||
XMPPConnection x0 = getConnection(0);
|
||||
XMPPConnection x1 = getConnection(1);
|
||||
|
||||
final JingleManager jm0 = new JingleManager(
|
||||
x0, new FixedResolver("127.0.0.1", 20004));
|
||||
final JingleManager jm1 = new JingleManager(
|
||||
x1, new FixedResolver("127.0.0.1", 20040));
|
||||
|
||||
// JingleManager jm0 = new JingleSessionManager(
|
||||
// x0, new ICEResolver());
|
||||
// JingleManager jm1 = new JingleSessionManager(
|
||||
// x1, new ICEResolver());
|
||||
//JingleManager jm0 = new ICETransportManager(x0, "stun.xten.net", 3478);
|
||||
//JingleManager jm1 = new ICETransportManager(x1, "stun.xten.net", 3478);
|
||||
|
||||
JingleMediaManager jingleMediaManager = new JingleMediaManager() {
|
||||
// Media Session Implementation
|
||||
|
@ -890,14 +888,15 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads());
|
||||
|
||||
session.start(request);
|
||||
} catch (XMPPException e) {
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
OutgoingJingleSession js0 = jm0.createOutgoingJingleSession("barata6@thiago/Smack");
|
||||
OutgoingJingleSession js0 = jm0.createOutgoingJingleSession(x1.getUser());
|
||||
|
||||
js0.start();
|
||||
|
||||
|
@ -911,7 +910,8 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
assertTrue(valCounter() == 8);
|
||||
//Thread.sleep(15000);
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -977,7 +977,7 @@ public class JingleManagerTest extends SmackTestCase {
|
|||
}
|
||||
|
||||
public void sessionEstablished(PayloadType pt,
|
||||
TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
|
||||
TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
|
||||
}
|
||||
|
||||
public void sessionRedirected(String redirection, JingleSession jingleSession) {
|
||||
|
|
Loading…
Reference in a new issue