mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 20:42:06 +01:00
JingleIBBAdapter test + getSid -> getStreamId (S5B)
This commit is contained in:
parent
8263a759b3
commit
9fe247b1dc
7 changed files with 19 additions and 15 deletions
|
@ -102,7 +102,7 @@ public class JingleS5BTransport extends JingleTransport<JingleS5BTransportElemen
|
|||
* @param other transport of the other party.
|
||||
*/
|
||||
JingleS5BTransport(FullJid initiator, FullJid responder, List<JingleTransportCandidate<?>> ourCandidates, JingleS5BTransport other) {
|
||||
this.sid = other.getSid();
|
||||
this.sid = other.getStreamId();
|
||||
this.mode = other.mode;
|
||||
this.ourDstAddr = Socks5Utils.createDigest(sid, responder, initiator);
|
||||
Socks5Proxy.getSocks5Proxy().addTransfer(ourDstAddr);
|
||||
|
@ -177,7 +177,7 @@ public class JingleS5BTransport extends JingleTransport<JingleS5BTransportElemen
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
public String getSid() {
|
||||
public String getStreamId() {
|
||||
return sid;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ public class JingleS5BTransport extends JingleTransport<JingleS5BTransportElemen
|
|||
public void prepare(XMPPConnection connection) {
|
||||
JingleSession session = getParent().getParent();
|
||||
if (getOurDstAddr() == null) {
|
||||
ourDstAddr = Socks5Utils.createDigest(getSid(), session.getOurJid(), session.getPeer());
|
||||
ourDstAddr = Socks5Utils.createDigest(getStreamId(), session.getOurJid(), session.getPeer());
|
||||
Socks5Proxy.getSocks5Proxy().addTransfer(ourDstAddr);
|
||||
}
|
||||
|
||||
|
@ -378,7 +378,7 @@ public class JingleS5BTransport extends JingleTransport<JingleS5BTransportElemen
|
|||
|
||||
private void activateProxy(JingleS5BTransportCandidate candidate) throws SmackException.NotConnectedException, InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException {
|
||||
LOGGER.log(Level.INFO, "Activate proxy: " + candidate.getCandidateId() + " " + candidate.getStreamHost().getAddress() + ":" + candidate.getStreamHost().getPort() + " " + candidate.getStreamHost().getJID() + " for " + getParent().getParent().getPeer());
|
||||
Bytestream activate = new Bytestream(getSid());
|
||||
Bytestream activate = new Bytestream(getStreamId());
|
||||
activate.setMode(null);
|
||||
activate.setType(IQ.Type.set);
|
||||
activate.setTo(candidate.getStreamHost().getJID());
|
||||
|
|
|
@ -39,7 +39,7 @@ public class JingleS5BTransportAdapter implements JingleTransportAdapter<JingleS
|
|||
candidates.add(JingleS5BTransportCandidate.fromElement((JingleS5BTransportCandidateElement) e));
|
||||
}
|
||||
|
||||
return new JingleS5BTransport(s5b.getSid(), s5b.getMode(), null, s5b.getDestinationAddress(), null, candidates);
|
||||
return new JingleS5BTransport(s5b.getStreamId(), s5b.getMode(), null, s5b.getDestinationAddress(), null, candidates);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -106,7 +106,7 @@ public class JingleS5BTransportCandidate extends JingleTransportCandidate<Jingle
|
|||
LOGGER.log(Level.INFO, getStreamHost().getAddress() + ":" + getStreamHost().getPort() + " " + getStreamHost().getJID().toString() + " " + getType());
|
||||
JingleContent content = transport.getParent();
|
||||
JingleSession session = content.getParent();
|
||||
client = new Socks5ClientForInitiator(getStreamHost(), transport.getOurDstAddr(), session.getJingleManager().getConnection(), transport.getSid(), session.getPeer());
|
||||
client = new Socks5ClientForInitiator(getStreamHost(), transport.getOurDstAddr(), session.getJingleManager().getConnection(), transport.getStreamId(), session.getPeer());
|
||||
}
|
||||
this.socket = client.getSocket(timeout);
|
||||
break;
|
||||
|
|
|
@ -213,7 +213,7 @@ public final class JingleS5BTransportManager extends Manager implements JingleTr
|
|||
|
||||
JingleS5BTransportElement.Builder tb = JingleS5BTransportElement.getBuilder()
|
||||
.setTransportInfo(info)
|
||||
.setStreamId(transport.getSid());
|
||||
.setStreamId(transport.getStreamId());
|
||||
|
||||
JingleElement jingle = jb.addJingleContent(cb.setTransport(tb.build()).build()).build();
|
||||
jingle.setFrom(session.getOurJid());
|
||||
|
|
|
@ -47,7 +47,7 @@ public class JingleS5BTransportElement extends JingleContentTransportElement {
|
|||
this.mode = mode;
|
||||
}
|
||||
|
||||
public String getSid() {
|
||||
public String getStreamId() {
|
||||
return sid;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ public class JingleIBBTransportTest extends SmackTestSuite {
|
|||
|
||||
transport1.handleSessionAccept(transport2.getElement(), null);
|
||||
assertEquals(transport2.getBlockSize(), transport1.getBlockSize());
|
||||
|
||||
JingleIBBTransport transport3 = new JingleIBBTransportAdapter().transportFromElement(transport2.getElement());
|
||||
assertEquals(transport2.getBlockSize(), transport3.getBlockSize());
|
||||
assertEquals(transport2.getStreamId(), transport3.getStreamId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -83,7 +83,7 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
"</transport>";
|
||||
JingleS5BTransportElement transportElement = new JingleS5BTransportProvider().parse(TestUtils.getParser(xml));
|
||||
assertEquals("972b7bf47291ca609517f67f86b5081086052dad", transportElement.getDestinationAddress());
|
||||
assertEquals("vj3hs98y", transportElement.getSid());
|
||||
assertEquals("vj3hs98y", transportElement.getStreamId());
|
||||
assertEquals(Bytestream.Mode.tcp, transportElement.getMode());
|
||||
assertEquals(3, transportElement.getCandidates().size());
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
|
||||
JingleS5BTransport transport = new JingleS5BTransportAdapter().transportFromElement(transportElement);
|
||||
assertNotNull(transport);
|
||||
assertEquals(transportElement.getSid(), transport.getSid());
|
||||
assertEquals(transportElement.getStreamId(), transport.getStreamId());
|
||||
assertEquals(transportElement.getMode(), transport.getMode());
|
||||
assertEquals(transportElement.getDestinationAddress(), transport.getTheirDstAddr());
|
||||
assertNull(transport.getOurDstAddr());
|
||||
|
@ -162,7 +162,7 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
.parse(TestUtils.getParser(candidateError));
|
||||
assertNull(candidateErrorTransport.getDestinationAddress());
|
||||
assertNotNull(candidateErrorTransport.getInfo());
|
||||
assertEquals("vj3hs98y", candidateErrorTransport.getSid());
|
||||
assertEquals("vj3hs98y", candidateErrorTransport.getStreamId());
|
||||
assertEquals(JingleS5BTransportInfoElement.CandidateError.INSTANCE,
|
||||
candidateErrorTransport.getInfo());
|
||||
assertEquals(candidateError, candidateErrorTransport.toXML().toString());
|
||||
|
@ -176,7 +176,7 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
assertNull(proxyErrorTransport.getDestinationAddress());
|
||||
assertNotNull(proxyErrorTransport.getInfo());
|
||||
assertNotNull(candidateErrorTransport.getInfo());
|
||||
assertEquals("vj3hs98y", proxyErrorTransport.getSid());
|
||||
assertEquals("vj3hs98y", proxyErrorTransport.getStreamId());
|
||||
assertEquals(JingleS5BTransportInfoElement.ProxyError.INSTANCE,
|
||||
proxyErrorTransport.getInfo());
|
||||
assertEquals(proxyError, proxyErrorTransport.toXML().toString());
|
||||
|
@ -271,7 +271,7 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
|
||||
JingleS5BTransport t1 = new JingleS5BTransport(initiator, responder, "tSes", Bytestream.Mode.tcp, c1);
|
||||
|
||||
assertEquals("tSes", t1.getSid());
|
||||
assertEquals("tSes", t1.getStreamId());
|
||||
assertEquals(Bytestream.Mode.tcp, t1.getMode());
|
||||
|
||||
assertEquals(Socks5Utils.createDigest("tSes", initiator, responder), t1.getOurDstAddr());
|
||||
|
@ -287,13 +287,13 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
assertEquals(t1.getOurDstAddr(), t1parsed.getTheirDstAddr());
|
||||
assertNull(t1parsed.getOurDstAddr());
|
||||
assertEquals(0, t1parsed.getOurCandidates().size());
|
||||
assertEquals(t1.getSid(), t1parsed.getSid());
|
||||
assertEquals(t1.getStreamId(), t1parsed.getStreamId());
|
||||
assertEquals(t1.getMode(), t1parsed.getMode());
|
||||
assertEquals(t1.getOurCandidates().size(), t1parsed.getTheirCandidates().size());
|
||||
|
||||
JingleS5BTransport t2 = new JingleS5BTransport(initiator, responder, c2, t1parsed);
|
||||
|
||||
assertEquals("tSes", t2.getSid());
|
||||
assertEquals("tSes", t2.getStreamId());
|
||||
assertEquals(Bytestream.Mode.tcp, t2.getMode());
|
||||
|
||||
assertEquals(Socks5Utils.createDigest("tSes", responder, initiator), t2.getOurDstAddr());
|
||||
|
|
Loading…
Reference in a new issue