mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-23 19:18:00 +01:00
ICE Transport now uses Wildfire Media Proxy as a last resort
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6869 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
59a7863401
commit
01abc3a797
12 changed files with 322 additions and 148 deletions
Binary file not shown.
|
@ -24,9 +24,11 @@ import de.javawi.jstun.test.demo.ice.Candidate;
|
||||||
import de.javawi.jstun.test.demo.ice.ICENegociator;
|
import de.javawi.jstun.test.demo.ice.ICENegociator;
|
||||||
import de.javawi.jstun.util.UtilityException;
|
import de.javawi.jstun.util.UtilityException;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ICE Resolver for Jingle transport method that results in sending data between two entities using the Interactive Connectivity Establishment (ICE) methodology. (XEP-0176)
|
* ICE Resolver for Jingle transport method that results in sending data between two entities using the Interactive Connectivity Establishment (ICE) methodology. (XEP-0176)
|
||||||
|
@ -37,8 +39,17 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class ICEResolver extends TransportResolver {
|
public class ICEResolver extends TransportResolver {
|
||||||
|
|
||||||
public ICEResolver() {
|
XMPPConnection connection;
|
||||||
|
Random random = new Random();
|
||||||
|
long sid;
|
||||||
|
String server = "stun.xten.net";
|
||||||
|
int port = 3478;
|
||||||
|
|
||||||
|
public ICEResolver(XMPPConnection connection, String server, int port) {
|
||||||
super();
|
super();
|
||||||
|
this.connection = connection;
|
||||||
|
this.server = server;
|
||||||
|
this.port = port;
|
||||||
this.setType(Type.ice);
|
this.setType(Type.ice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,25 +57,79 @@ public class ICEResolver extends TransportResolver {
|
||||||
if (!isResolving() && !isResolved()) {
|
if (!isResolving() && !isResolved()) {
|
||||||
System.out.println("Initialized");
|
System.out.println("Initialized");
|
||||||
|
|
||||||
ICENegociator cc = new ICENegociator((short) 1);
|
ICENegociator cc = new ICENegociator((short) 1, server, port);
|
||||||
// gather candidates
|
// gather candidates
|
||||||
cc.gatherCandidateAddresses();
|
cc.gatherCandidateAddresses();
|
||||||
// priorize candidates
|
// priorize candidates
|
||||||
cc.prioritizeCandidates();
|
cc.prioritizeCandidates();
|
||||||
// get SortedCandidates
|
|
||||||
//List<Candidate> sortedCandidates = cc.getSortedCandidates();
|
|
||||||
|
|
||||||
for (Candidate candidate : cc.getSortedCandidates())
|
for (Candidate candidate : cc.getSortedCandidates())
|
||||||
try {
|
try {
|
||||||
TransportCandidate transportCandidate = new TransportCandidate.Ice(candidate.getAddress().getInetAddress().getHostAddress(), 1, candidate.getNetwork(), "1", candidate.getPort(), "1", candidate.getPriority());
|
Candidate.CandidateType type = candidate.getCandidateType();
|
||||||
|
String typeString = "local";
|
||||||
|
if (type.equals(Candidate.CandidateType.ServerReflexive))
|
||||||
|
typeString = "srflx";
|
||||||
|
else if (type.equals(Candidate.CandidateType.PeerReflexive))
|
||||||
|
typeString = "prflx";
|
||||||
|
else if (type.equals(Candidate.CandidateType.Relayed))
|
||||||
|
typeString = "relay";
|
||||||
|
else
|
||||||
|
typeString = "host";
|
||||||
|
|
||||||
|
TransportCandidate transportCandidate = new TransportCandidate.Ice(candidate.getAddress().getInetAddress().getHostAddress(), 1, candidate.getNetwork(), "1", candidate.getPort(), "1", candidate.getPriority(), typeString);
|
||||||
transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress());
|
transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress());
|
||||||
|
transportCandidate.setPort(getFreePort());
|
||||||
this.addCandidate(transportCandidate);
|
this.addCandidate(transportCandidate);
|
||||||
System.out.println("C: " + candidate.getAddress().getInetAddress() + "|" + candidate.getBase().getAddress().getInetAddress() + " p:" + candidate.getPriority());
|
System.out.println("C: " + candidate.getAddress().getInetAddress() + "|" + candidate.getBase().getAddress().getInetAddress() + " p:" + candidate.getPriority());
|
||||||
} catch (UtilityException e) {
|
|
||||||
e.printStackTrace();
|
}
|
||||||
} catch (UnknownHostException e) {
|
catch (UtilityException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
catch (UnknownHostException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RTPBridge.serviceAvailable(connection)) {
|
||||||
|
try {
|
||||||
|
String localIp = cc.getPublicCandidate().getBase().getAddress().getInetAddress().getHostAddress();
|
||||||
|
|
||||||
|
sid = Math.abs(random.nextLong());
|
||||||
|
|
||||||
|
RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valueOf(sid));
|
||||||
|
|
||||||
|
TransportCandidate localCandidate = new TransportCandidate.Ice(
|
||||||
|
rtpBridge.getIp(), 1, cc.getPublicCandidate().getNetwork(), "1", rtpBridge.getPortA(), "1", 0, "relay");
|
||||||
|
localCandidate.setLocalIp(localIp);
|
||||||
|
|
||||||
|
TransportCandidate remoteCandidate = new TransportCandidate.Ice(
|
||||||
|
rtpBridge.getIp(), 1, cc.getPublicCandidate().getNetwork(), "1", rtpBridge.getPortB(), "1", 0, "relay");
|
||||||
|
remoteCandidate.setLocalIp(localIp);
|
||||||
|
|
||||||
|
localCandidate.setSymmetric(remoteCandidate);
|
||||||
|
remoteCandidate.setSymmetric(localCandidate);
|
||||||
|
|
||||||
|
localCandidate.setPassword(rtpBridge.getPass());
|
||||||
|
remoteCandidate.setPassword(rtpBridge.getPass());
|
||||||
|
|
||||||
|
localCandidate.setSessionId(rtpBridge.getSid());
|
||||||
|
remoteCandidate.setSessionId(rtpBridge.getSid());
|
||||||
|
|
||||||
|
localCandidate.setConnection(this.connection);
|
||||||
|
remoteCandidate.setConnection(this.connection);
|
||||||
|
|
||||||
|
addCandidate(localCandidate);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (UtilityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
catch (UnknownHostException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this.setInitialized();
|
this.setInitialized();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +1,41 @@
|
||||||
package org.jivesoftware.smackx.jingle.nat;
|
package org.jivesoftware.smackx.jingle.nat;
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
import org.jivesoftware.smackx.jingle.media.PayloadType;
|
||||||
|
import org.jivesoftware.smackx.jingle.JingleSession;
|
||||||
|
import org.jivesoftware.smackx.jingle.listeners.JingleSessionListener;
|
||||||
|
import org.jivesoftware.smackx.jingle.listeners.CreatedJingleSessionListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $RCSfile$
|
* $RCSfile$
|
||||||
* $Revision: $
|
* $Revision: $
|
||||||
* $Date: 02/01/2007
|
* $Date: 02/01/2007
|
||||||
*
|
* <p/>
|
||||||
* Copyright 2003-2006 Jive Software.
|
* Copyright 2003-2006 Jive Software.
|
||||||
*
|
* <p/>
|
||||||
* All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
|
* All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p/>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p/>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
public class ICETransportManager extends JingleTransportManager {
|
public class ICETransportManager extends JingleTransportManager implements JingleSessionListener, CreatedJingleSessionListener {
|
||||||
|
|
||||||
ICEResolver iceResolver = null;
|
ICEResolver iceResolver = null;
|
||||||
|
|
||||||
public ICETransportManager() {
|
public ICETransportManager(XMPPConnection xmppConnection, String server, int port) {
|
||||||
iceResolver = new ICEResolver();
|
iceResolver = new ICEResolver(xmppConnection, server, port);
|
||||||
try {
|
try {
|
||||||
iceResolver.initializeAndWait();
|
iceResolver.initializeAndWait();
|
||||||
} catch (XMPPException e) {
|
}
|
||||||
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,10 +43,34 @@ public class ICETransportManager extends JingleTransportManager {
|
||||||
protected TransportResolver createResolver() {
|
protected TransportResolver createResolver() {
|
||||||
try {
|
try {
|
||||||
iceResolver.resolve();
|
iceResolver.resolve();
|
||||||
} catch (XMPPException e) {
|
}
|
||||||
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return iceResolver;
|
return iceResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implement a Session Listener to relay candidates after establishment
|
||||||
|
|
||||||
|
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
|
||||||
|
RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sessionDeclined(String reason, JingleSession jingleSession) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sessionRedirected(String redirection, JingleSession jingleSession) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sessionClosed(String reason, JingleSession jingleSession) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Session Created
|
||||||
|
|
||||||
|
public void sessionCreated(JingleSession jingleSession) {
|
||||||
|
jingleSession.addListener(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,6 +452,8 @@ public abstract class TransportCandidate {
|
||||||
|
|
||||||
private int network;
|
private int network;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
public Ice() {
|
public Ice() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -468,10 +470,11 @@ public abstract class TransportCandidate {
|
||||||
* @param username user name, as it is used in ICE
|
* @param username user name, as it is used in ICE
|
||||||
* @param preference preference for this transportElement, as it is used
|
* @param preference preference for this transportElement, as it is used
|
||||||
* in ICE
|
* in ICE
|
||||||
|
* @param type type as defined in ICE-12
|
||||||
*/
|
*/
|
||||||
public Ice(String ip, int generation, int network,
|
public Ice(String ip, int generation, int network,
|
||||||
String password, int port, String username,
|
String password, int port, String username,
|
||||||
int preference) {
|
int preference, String type) {
|
||||||
super(ip, port, generation);
|
super(ip, port, generation);
|
||||||
|
|
||||||
proto = Protocol.UDP;
|
proto = Protocol.UDP;
|
||||||
|
@ -481,6 +484,7 @@ public abstract class TransportCandidate {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.preference = preference;
|
this.preference = preference;
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -592,6 +596,22 @@ public abstract class TransportCandidate {
|
||||||
this.preference = preference;
|
this.preference = preference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Candidate Type
|
||||||
|
* @return candidate Type
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Candidate Type
|
||||||
|
* @param type candidate type.
|
||||||
|
*/
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -21,8 +21,8 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transport negotiator.
|
* Transport negotiator.
|
||||||
*
|
* <p/>
|
||||||
*
|
* <p/>
|
||||||
* This class is responsible for managing the transport negotiation process,
|
* This class is responsible for managing the transport negotiation process,
|
||||||
* handling all the packet interchange and the stage control.
|
* handling all the packet interchange and the stage control.
|
||||||
*
|
*
|
||||||
|
@ -252,7 +252,8 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(CANDIDATES_ACCEPT_PERIOD
|
Thread.sleep(CANDIDATES_ACCEPT_PERIOD
|
||||||
+ TransportResolver.CHECK_TIMEOUT);
|
+ TransportResolver.CHECK_TIMEOUT);
|
||||||
} catch (InterruptedException e) {
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,31 +440,37 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
setState(inviting);
|
setState(inviting);
|
||||||
jout = getState().eventInvite();
|
jout = getState().eventInvite();
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (iq instanceof Jingle) {
|
if (iq instanceof Jingle) {
|
||||||
// If there is no specific jmf action associated, then we
|
// If there is no specific jmf action associated, then we
|
||||||
// are being invited to a new session...
|
// are being invited to a new session...
|
||||||
setState(accepting);
|
setState(accepting);
|
||||||
jout = getState().eventInitiate((Jingle) iq);
|
jout = getState().eventInitiate((Jingle) iq);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Invitation IQ received is not a Jingle packet in Transport negotiator.");
|
"Invitation IQ received is not a Jingle packet in Transport negotiator.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (iq == null) {
|
if (iq == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (iq.getType().equals(IQ.Type.ERROR)) {
|
if (iq.getType().equals(IQ.Type.ERROR)) {
|
||||||
// Process errors
|
// Process errors
|
||||||
getState().eventError(iq);
|
getState().eventError(iq);
|
||||||
} else if (iq.getType().equals(IQ.Type.RESULT)) {
|
}
|
||||||
|
else if (iq.getType().equals(IQ.Type.RESULT)) {
|
||||||
// Process ACKs
|
// Process ACKs
|
||||||
if (isExpectedId(iq.getPacketID())) {
|
if (isExpectedId(iq.getPacketID())) {
|
||||||
jout = getState().eventAck(iq);
|
jout = getState().eventAck(iq);
|
||||||
removeExpectedId(iq.getPacketID());
|
removeExpectedId(iq.getPacketID());
|
||||||
}
|
}
|
||||||
} else if (iq instanceof Jingle) {
|
}
|
||||||
|
else if (iq instanceof Jingle) {
|
||||||
// Get the action from the Jingle packet
|
// Get the action from the Jingle packet
|
||||||
Jingle jin = (Jingle) iq;
|
Jingle jin = (Jingle) iq;
|
||||||
Jingle.Action action = jin.getAction();
|
Jingle.Action action = jin.getAction();
|
||||||
|
@ -471,11 +478,14 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
if (action.equals(Jingle.Action.TRANSPORTACCEPT)) {
|
if (action.equals(Jingle.Action.TRANSPORTACCEPT)) {
|
||||||
jout = getState().eventAccept(jin);
|
jout = getState().eventAccept(jin);
|
||||||
} else if (action.equals(Jingle.Action.TRANSPORTDECLINE)) {
|
}
|
||||||
|
else if (action.equals(Jingle.Action.TRANSPORTDECLINE)) {
|
||||||
jout = getState().eventDecline(jin);
|
jout = getState().eventDecline(jin);
|
||||||
} else if (action.equals(Jingle.Action.TRANSPORTINFO)) {
|
}
|
||||||
|
else if (action.equals(Jingle.Action.TRANSPORTINFO)) {
|
||||||
jout = getState().eventInfo(jin);
|
jout = getState().eventInfo(jin);
|
||||||
} else if (action.equals(Jingle.Action.TRANSPORTMODIFY)) {
|
}
|
||||||
|
else if (action.equals(Jingle.Action.TRANSPORTMODIFY)) {
|
||||||
jout = getState().eventModify(jin);
|
jout = getState().eventModify(jin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -486,7 +496,8 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
// Save the Id for any ACK
|
// Save the Id for any ACK
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
addExpectedId(id);
|
addExpectedId(id);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (jout != null) {
|
if (jout != null) {
|
||||||
addExpectedId(jout.getPacketID());
|
addExpectedId(jout.getPacketID());
|
||||||
}
|
}
|
||||||
|
@ -584,6 +595,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
* connection...
|
* connection...
|
||||||
*/
|
*/
|
||||||
public final class Accepting extends JingleNegotiator.State {
|
public final class Accepting extends JingleNegotiator.State {
|
||||||
|
|
||||||
public Accepting(TransportNegotiator neg) {
|
public Accepting(TransportNegotiator neg) {
|
||||||
super(neg);
|
super(neg);
|
||||||
}
|
}
|
||||||
|
@ -751,7 +763,8 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
ArrayList cands = getValidRemoteCandidatesList();
|
ArrayList cands = getValidRemoteCandidatesList();
|
||||||
if (!cands.isEmpty()) {
|
if (!cands.isEmpty()) {
|
||||||
return (TransportCandidate) cands.get(0);
|
return (TransportCandidate) cands.get(0);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
System.out.println("No Remote Candidate");
|
System.out.println("No Remote Candidate");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -803,13 +816,13 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
|
|
||||||
ArrayList<TransportCandidate.Ice> cands = getValidRemoteCandidatesList();
|
ArrayList<TransportCandidate.Ice> cands = getValidRemoteCandidatesList();
|
||||||
if (!cands.isEmpty()) {
|
if (!cands.isEmpty()) {
|
||||||
int lowest = 65560;
|
int highest = -1;
|
||||||
TransportCandidate.Ice chose = null;
|
TransportCandidate.Ice chose = null;
|
||||||
for (TransportCandidate.Ice transportCandidate : cands) {
|
for (TransportCandidate.Ice transportCandidate : cands) {
|
||||||
System.out.println("Pref: " + transportCandidate.getPreference() + " :" + transportCandidate.getIp());
|
System.out.println("Pref: " + transportCandidate.getPreference() + " :" + transportCandidate.getIp());
|
||||||
if (transportCandidate.getPreference() < lowest) {
|
if (transportCandidate.getPreference() > highest) {
|
||||||
chose = transportCandidate;
|
chose = transportCandidate;
|
||||||
lowest = transportCandidate.getPreference();
|
highest = transportCandidate.getPreference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = chose;
|
result = chose;
|
||||||
|
@ -822,20 +835,24 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
* Return true for ICE candidates.
|
* Return true for ICE candidates.
|
||||||
*/
|
*/
|
||||||
public boolean acceptableTransportCandidate(TransportCandidate tc) {
|
public boolean acceptableTransportCandidate(TransportCandidate tc) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
TransportCandidate.Ice ice = (TransportCandidate.Ice) tc;
|
||||||
|
if (ice.getType().equals("relay")) return true;
|
||||||
|
if(true) return false;
|
||||||
InetAddress.getByName(tc.getIp()).isReachable(3000);
|
InetAddress.getByName(tc.getIp()).isReachable(3000);
|
||||||
DatagramSocket socket = new DatagramSocket(0);
|
DatagramSocket socket = new DatagramSocket(0);
|
||||||
socket.connect(InetAddress.getByName(tc.getIp()), tc.getPort());
|
socket.connect(InetAddress.getByName(tc.getIp()), tc.getPort());
|
||||||
return true;
|
return true;
|
||||||
} catch (SocketException e) {
|
}
|
||||||
e.printStackTrace();
|
catch (SocketException e) {
|
||||||
} catch (UnknownHostException e) {
|
e.printStackTrace();
|
||||||
e.printStackTrace();
|
}
|
||||||
} catch (IOException e) {
|
catch (UnknownHostException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,6 +314,7 @@ public class JingleTransport implements PacketExtension {
|
||||||
buf.append(" username=\"").append(tci.getUsername()).append("\"");
|
buf.append(" username=\"").append(tci.getUsername()).append("\"");
|
||||||
buf.append(" password=\"").append(tci.getPassword()).append("\"");
|
buf.append(" password=\"").append(tci.getPassword()).append("\"");
|
||||||
buf.append(" preference=\"").append(tci.getPreference()).append("\"");
|
buf.append(" preference=\"").append(tci.getPreference()).append("\"");
|
||||||
|
buf.append(" type=\"").append(tci.getType()).append("\"");
|
||||||
|
|
||||||
// Optional elements
|
// Optional elements
|
||||||
if (transportCandidate.getName() != null) {
|
if (transportCandidate.getName() != null) {
|
||||||
|
|
|
@ -50,10 +50,12 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider
|
||||||
if (name.equals(JingleTransportCandidate.NODENAME)) {
|
if (name.equals(JingleTransportCandidate.NODENAME)) {
|
||||||
JingleTransportCandidate jtc = parseCandidate(parser);
|
JingleTransportCandidate jtc = parseCandidate(parser);
|
||||||
if (jtc != null) trans.addCandidate(jtc);
|
if (jtc != null) trans.addCandidate(jtc);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
throw new Exception("Unknown tag \"" + name + "\" in transport element.");
|
throw new Exception("Unknown tag \"" + name + "\" in transport element.");
|
||||||
}
|
}
|
||||||
} else if (eventType == XmlPullParser.END_TAG) {
|
}
|
||||||
|
else if (eventType == XmlPullParser.END_TAG) {
|
||||||
if (name.equals(JingleTransport.NODENAME)) {
|
if (name.equals(JingleTransport.NODENAME)) {
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
@ -107,6 +109,7 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider
|
||||||
String port = parser.getAttributeValue("", "port");
|
String port = parser.getAttributeValue("", "port");
|
||||||
String preference = parser.getAttributeValue("", "preference");
|
String preference = parser.getAttributeValue("", "preference");
|
||||||
String proto = parser.getAttributeValue("", "proto");
|
String proto = parser.getAttributeValue("", "proto");
|
||||||
|
String type = parser.getAttributeValue("", "type");
|
||||||
|
|
||||||
if (channel != null) {
|
if (channel != null) {
|
||||||
mt.setChannel(new TransportCandidate.Channel(channel));
|
mt.setChannel(new TransportCandidate.Channel(channel));
|
||||||
|
@ -115,13 +118,15 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider
|
||||||
if (generation != null) {
|
if (generation != null) {
|
||||||
try {
|
try {
|
||||||
mt.setGeneration(Integer.parseInt(generation));
|
mt.setGeneration(Integer.parseInt(generation));
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ip != null) {
|
if (ip != null) {
|
||||||
mt.setIp(ip);
|
mt.setIp(ip);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +137,8 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider
|
||||||
if (network != null) {
|
if (network != null) {
|
||||||
try {
|
try {
|
||||||
mt.setNetwork(Integer.parseInt(network));
|
mt.setNetwork(Integer.parseInt(network));
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,14 +153,16 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider
|
||||||
if (port != null) {
|
if (port != null) {
|
||||||
try {
|
try {
|
||||||
mt.setPort(Integer.parseInt(port));
|
mt.setPort(Integer.parseInt(port));
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preference != null) {
|
if (preference != null) {
|
||||||
try {
|
try {
|
||||||
mt.setPreference(Integer.parseInt(preference));
|
mt.setPreference(Integer.parseInt(preference));
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,6 +170,10 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider
|
||||||
mt.setProto(new TransportCandidate.Protocol(proto));
|
mt.setProto(new TransportCandidate.Protocol(proto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type != null) {
|
||||||
|
mt.setType(type);
|
||||||
|
}
|
||||||
|
|
||||||
return new JingleTransport.Ice.Candidate(mt);
|
return new JingleTransport.Ice.Candidate(mt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,7 +219,8 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider
|
||||||
if (generation != null) {
|
if (generation != null) {
|
||||||
try {
|
try {
|
||||||
mt.setGeneration(Integer.parseInt(generation));
|
mt.setGeneration(Integer.parseInt(generation));
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +235,8 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider
|
||||||
if (port != null) {
|
if (port != null) {
|
||||||
try {
|
try {
|
||||||
mt.setPort(Integer.parseInt(port));
|
mt.setPort(Integer.parseInt(port));
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new JingleTransport.RawUdp.Candidate(mt);
|
return new JingleTransport.RawUdp.Candidate(mt);
|
||||||
|
|
|
@ -59,15 +59,15 @@ public class STUNResolverTest extends SmackTestCase {
|
||||||
int highestPref = 100;
|
int highestPref = 100;
|
||||||
|
|
||||||
TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2,
|
TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2,
|
||||||
"password", 3468, "username1", 1);
|
"password", 3468, "username1", 1, "");
|
||||||
TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10,
|
TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10,
|
||||||
"password", 3469, "username2", 15);
|
"password", 3469, "username2", 15, "");
|
||||||
TransportCandidate candH = new TransportCandidate.Ice("192.168.2.11", 1, 2,
|
TransportCandidate candH = new TransportCandidate.Ice("192.168.2.11", 1, 2,
|
||||||
"password", 3468, "usernameH", highestPref);
|
"password", 3468, "usernameH", highestPref, "");
|
||||||
TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10,
|
TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10,
|
||||||
"password", 3469, "username3", 2);
|
"password", 3469, "username3", 2, "");
|
||||||
TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2,
|
TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2,
|
||||||
"password", 3468, "username4", 78);
|
"password", 3468, "username4", 78, "");
|
||||||
|
|
||||||
STUNResolver stunResolver = new STUNResolver() {
|
STUNResolver stunResolver = new STUNResolver() {
|
||||||
};
|
};
|
||||||
|
@ -89,17 +89,17 @@ public class STUNResolverTest extends SmackTestCase {
|
||||||
int highestPref = 100;
|
int highestPref = 100;
|
||||||
|
|
||||||
TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2,
|
TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2,
|
||||||
"password", 3468, "username1", 1);
|
"password", 3468, "username1", 1, "");
|
||||||
TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10,
|
TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10,
|
||||||
"password", 3469, "username2", 15);
|
"password", 3469, "username2", 15, "");
|
||||||
TransportCandidate candH = new TransportCandidate.Ice("192.168.2.11", 1, 2,
|
TransportCandidate candH = new TransportCandidate.Ice("192.168.2.11", 1, 2,
|
||||||
"password", 3468, "usernameH", highestPref);
|
"password", 3468, "usernameH", highestPref, "");
|
||||||
TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10,
|
TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10,
|
||||||
"password", 3469, "username3", 2);
|
"password", 3469, "username3", 2, "");
|
||||||
TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2,
|
TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2,
|
||||||
"password", 3468, "username4", 78);
|
"password", 3468, "username4", 78, "");
|
||||||
|
|
||||||
ICEResolver iceResolver = new ICEResolver() {
|
ICEResolver iceResolver = new ICEResolver(getConnection(0), "stun.xten.net", 3478) {
|
||||||
};
|
};
|
||||||
iceResolver.addCandidate(cand1);
|
iceResolver.addCandidate(cand1);
|
||||||
iceResolver.addCandidate(cand2);
|
iceResolver.addCandidate(cand2);
|
||||||
|
@ -131,12 +131,14 @@ public class STUNResolverTest extends SmackTestCase {
|
||||||
|
|
||||||
for (Candidate candidate : cc.getSortedCandidates())
|
for (Candidate candidate : cc.getSortedCandidates())
|
||||||
try {
|
try {
|
||||||
TransportCandidate transportCandidate = new TransportCandidate.Ice(candidate.getAddress().getInetAddress().getHostAddress(), 1, candidate.getNetwork(), "1", candidate.getPort(), "1", candidate.getPriority());
|
TransportCandidate transportCandidate = new TransportCandidate.Ice(candidate.getAddress().getInetAddress().getHostAddress(), 1, candidate.getNetwork(), "1", candidate.getPort(), "1", candidate.getPriority(), "");
|
||||||
transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress());
|
transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress());
|
||||||
System.out.println("C: " + candidate.getAddress().getInetAddress() + "|" + candidate.getBase().getAddress().getInetAddress() + " p:" + candidate.getPriority());
|
System.out.println("C: " + candidate.getAddress().getInetAddress() + "|" + candidate.getBase().getAddress().getInetAddress() + " p:" + candidate.getPriority());
|
||||||
} catch (UtilityException e) {
|
}
|
||||||
|
catch (UtilityException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (UnknownHostException e) {
|
}
|
||||||
|
catch (UnknownHostException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
Candidate candidate = cc.getSortedCandidates().get(0);
|
Candidate candidate = cc.getSortedCandidates().get(0);
|
||||||
|
@ -206,7 +208,8 @@ public class STUNResolverTest extends SmackTestCase {
|
||||||
Thread.sleep(55000);
|
Thread.sleep(55000);
|
||||||
assertTrue(valCounter() > 0);
|
assertTrue(valCounter() > 0);
|
||||||
stunResolver.resolve();
|
stunResolver.resolve();
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,7 +300,8 @@ public class STUNResolverTest extends SmackTestCase {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
session1.start(request);
|
session1.start(request);
|
||||||
} catch (XMPPException e) {
|
}
|
||||||
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,7 +342,8 @@ public class STUNResolverTest extends SmackTestCase {
|
||||||
|
|
||||||
assertTrue(valCounter() == 2);
|
assertTrue(valCounter() == 2);
|
||||||
|
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
fail("An error occured with Jingle");
|
fail("An error occured with Jingle");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.jivesoftware.smackx.jingle.nat;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.jivesoftware.smack.test.SmackTestCase;
|
import org.jivesoftware.smack.test.SmackTestCase;
|
||||||
|
|
||||||
public class TransportCandidateTest extends SmackTestCase {
|
public class TransportCandidateTest extends SmackTestCase {
|
||||||
|
@ -15,11 +16,11 @@ public class TransportCandidateTest extends SmackTestCase {
|
||||||
*/
|
*/
|
||||||
public void testEqualsObject() {
|
public void testEqualsObject() {
|
||||||
TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 1, 2,
|
TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 1, 2,
|
||||||
"password", 3468, "username", 25);
|
"password", 3468, "username", 25, "");
|
||||||
TransportCandidate cand2 = new TransportCandidate.Ice("192.168.2.1", 1, 2,
|
TransportCandidate cand2 = new TransportCandidate.Ice("192.168.2.1", 1, 2,
|
||||||
"password", 3468, "username", 25);
|
"password", 3468, "username", 25, "");
|
||||||
TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.1", 1, 2,
|
TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.1", 1, 2,
|
||||||
"password", 3469, "username", 25);
|
"password", 3469, "username", 25, "");
|
||||||
|
|
||||||
assertEquals(cand1, cand2);
|
assertEquals(cand1, cand2);
|
||||||
assertFalse(cand1.equals(cand3));
|
assertFalse(cand1.equals(cand3));
|
||||||
|
@ -32,15 +33,15 @@ public class TransportCandidateTest extends SmackTestCase {
|
||||||
int highestPref = 100;
|
int highestPref = 100;
|
||||||
|
|
||||||
TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2,
|
TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2,
|
||||||
"password", 3468, "username", 1);
|
"password", 3468, "username", 1, "");
|
||||||
TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10,
|
TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10,
|
||||||
"password", 3469, "username", 15);
|
"password", 3469, "username", 15, "");
|
||||||
TransportCandidate candH = new TransportCandidate.Ice("192.168.2.1", 1, 2,
|
TransportCandidate candH = new TransportCandidate.Ice("192.168.2.1", 1, 2,
|
||||||
"password", 3468, "username", highestPref);
|
"password", 3468, "username", highestPref, "");
|
||||||
TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10,
|
TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10,
|
||||||
"password", 3469, "username", 2);
|
"password", 3469, "username", 2, "");
|
||||||
TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2,
|
TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2,
|
||||||
"password", 3468, "username", 78);
|
"password", 3468, "username", 78, "");
|
||||||
|
|
||||||
ArrayList candList = new ArrayList();
|
ArrayList candList = new ArrayList();
|
||||||
candList.add(cand1);
|
candList.add(cand1);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.jivesoftware.smackx.jingle.media.JingleMediaManager;
|
||||||
import org.jivesoftware.smackx.jingle.media.JingleMediaSession;
|
import org.jivesoftware.smackx.jingle.media.JingleMediaSession;
|
||||||
import org.jivesoftware.smackx.jingle.media.PayloadType;
|
import org.jivesoftware.smackx.jingle.media.PayloadType;
|
||||||
import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
|
import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
|
||||||
|
import org.jivesoftware.jingleaudio.JMFInit;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -101,10 +102,9 @@ public class JmfMediaManager extends JingleMediaManager {
|
||||||
// should be and put it there.
|
// should be and put it there.
|
||||||
runLinuxPreInstall();
|
runLinuxPreInstall();
|
||||||
|
|
||||||
if (jmfProperties.length() == 0) {
|
//if (jmfProperties.length() == 0) {
|
||||||
//JMFInit init = new JMFInit(null);
|
JMFInit init = new JMFInit(null, false);
|
||||||
//init.setVisible(false);
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import org.jivesoftware.smackx.jingle.media.JingleMediaManager;
|
||||||
import org.jivesoftware.smackx.jingle.media.JingleMediaSession;
|
import org.jivesoftware.smackx.jingle.media.JingleMediaSession;
|
||||||
import org.jivesoftware.smackx.jingle.media.PayloadType;
|
import org.jivesoftware.smackx.jingle.media.PayloadType;
|
||||||
import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
|
import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
|
||||||
|
import org.jivesoftware.jingleaudio.JMFInit;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -12,15 +13,15 @@ import java.io.IOException;
|
||||||
* $RCSfile$
|
* $RCSfile$
|
||||||
* $Revision: $
|
* $Revision: $
|
||||||
* $Date: 25/12/2006
|
* $Date: 25/12/2006
|
||||||
*
|
* <p/>
|
||||||
* Copyright 2003-2006 Jive Software.
|
* Copyright 2003-2006 Jive Software.
|
||||||
*
|
* <p/>
|
||||||
* All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
|
* All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
* <p/>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
* <p/>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -84,8 +85,7 @@ public class SpeexMediaManager extends JingleMediaManager {
|
||||||
runLinuxPreInstall();
|
runLinuxPreInstall();
|
||||||
|
|
||||||
if (jmfProperties.length() == 0) {
|
if (jmfProperties.length() == 0) {
|
||||||
//JMFInit init = new JMFInit(null);
|
JMFInit init = new JMFInit(null, false);
|
||||||
//init.setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,16 @@ public class JingleMediaTest extends TestCase {
|
||||||
x1.connect();
|
x1.connect();
|
||||||
x1.login("barata6", "barata6");
|
x1.login("barata6", "barata6");
|
||||||
|
|
||||||
|
ICETransportManager icetm0 = new ICETransportManager(x0, "stun.xten.net", 3478);
|
||||||
|
ICETransportManager icetm1 = new ICETransportManager(x1, "stun.xten.net", 3478);
|
||||||
|
|
||||||
final JingleManager jm0 = new JingleManager(
|
final JingleManager jm0 = new JingleManager(
|
||||||
x0, new ICETransportManager());
|
x0, icetm0);
|
||||||
final JingleManager jm1 = new JingleManager(
|
final JingleManager jm1 = new JingleManager(
|
||||||
x1, new ICETransportManager());
|
x1, icetm1);
|
||||||
|
|
||||||
|
jm0.addCreationListener(icetm0);
|
||||||
|
jm1.addCreationListener(icetm1);
|
||||||
|
|
||||||
JingleMediaManager jingleMediaManager0 = new JmfMediaManager();
|
JingleMediaManager jingleMediaManager0 = new JmfMediaManager();
|
||||||
JingleMediaManager jingleMediaManager1 = new JmfMediaManager();
|
JingleMediaManager jingleMediaManager1 = new JmfMediaManager();
|
||||||
|
@ -70,7 +76,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
try {
|
try {
|
||||||
IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads());
|
IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads());
|
||||||
session.start(request);
|
session.start(request);
|
||||||
} catch (XMPPException e) {
|
}
|
||||||
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +96,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
x0.disconnect();
|
x0.disconnect();
|
||||||
x1.disconnect();
|
x1.disconnect();
|
||||||
|
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +136,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads());
|
IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads());
|
||||||
|
|
||||||
session.start(request);
|
session.start(request);
|
||||||
} catch (XMPPException e) {
|
}
|
||||||
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +156,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
x0.disconnect();
|
x0.disconnect();
|
||||||
x1.disconnect();
|
x1.disconnect();
|
||||||
|
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,8 +188,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
jm0.addCreationListener(btm0);
|
jm0.addCreationListener(btm0);
|
||||||
jm1.addCreationListener(btm1);
|
jm1.addCreationListener(btm1);
|
||||||
|
|
||||||
JingleMediaManager jingleMediaManager = new SpeexMediaManager();
|
JingleMediaManager jingleMediaManager = new JmfMediaManager();
|
||||||
JingleMediaManager jingleMediaManager2 = new SpeexMediaManager();
|
JingleMediaManager jingleMediaManager2 = new JmfMediaManager();
|
||||||
|
|
||||||
jm0.setMediaManager(jingleMediaManager);
|
jm0.setMediaManager(jingleMediaManager);
|
||||||
jm1.setMediaManager(jingleMediaManager2);
|
jm1.setMediaManager(jingleMediaManager2);
|
||||||
|
@ -191,7 +201,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads());
|
IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads());
|
||||||
|
|
||||||
session.start(request);
|
session.start(request);
|
||||||
} catch (XMPPException e) {
|
}
|
||||||
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +222,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
x0.disconnect();
|
x0.disconnect();
|
||||||
x1.disconnect();
|
x1.disconnect();
|
||||||
|
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,7 +234,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(250000);
|
Thread.sleep(250000);
|
||||||
} catch (InterruptedException e) {
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
|
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,7 +275,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads());
|
IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads());
|
||||||
|
|
||||||
session.start(request);
|
session.start(request);
|
||||||
} catch (XMPPException e) {
|
}
|
||||||
|
catch (XMPPException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +306,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
x0.disconnect();
|
x0.disconnect();
|
||||||
x1.disconnect();
|
x1.disconnect();
|
||||||
|
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +325,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
} catch (InterruptedException e) {
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,10 +335,12 @@ public class JingleMediaTest extends TestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
} catch (InterruptedException e) {
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +360,8 @@ public class JingleMediaTest extends TestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(10000);
|
Thread.sleep(10000);
|
||||||
} catch (InterruptedException e) {
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,11 +370,13 @@ public class JingleMediaTest extends TestCase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
catch (InterruptedException e) {
|
||||||
} catch (Exception e) {
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue