mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 20:42:06 +01:00
Merge js5btbFixes
This commit is contained in:
commit
ff899d05e7
2 changed files with 31 additions and 2 deletions
|
@ -93,8 +93,8 @@ public class JingleS5BTransport extends JingleContentTransport {
|
|||
private String streamId;
|
||||
private String dstAddr;
|
||||
private Bytestream.Mode mode;
|
||||
private ArrayList<JingleContentTransportCandidate> candidates = new ArrayList<>();
|
||||
private JingleContentTransportInfo info = null;
|
||||
private final ArrayList<JingleContentTransportCandidate> candidates = new ArrayList<>();
|
||||
private JingleContentTransportInfo info;
|
||||
|
||||
public Builder setStreamId(String sid) {
|
||||
this.streamId = sid;
|
||||
|
@ -112,11 +112,22 @@ public class JingleS5BTransport extends JingleContentTransport {
|
|||
}
|
||||
|
||||
public Builder addTransportCandidate(JingleS5BTransportCandidate candidate) {
|
||||
if (info != null) {
|
||||
throw new IllegalStateException("Builder has already an info set. " +
|
||||
"The transport can only have either an info or transport candidates, not both.");
|
||||
}
|
||||
this.candidates.add(candidate);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setTransportInfo(JingleContentTransportInfo info) {
|
||||
if (!candidates.isEmpty()) {
|
||||
throw new IllegalStateException("Builder has already at least one candidate set. " +
|
||||
"The transport can only have either an info or transport candidates, not both.");
|
||||
}
|
||||
if (this.info != null) {
|
||||
throw new IllegalStateException("Builder has already an info set.");
|
||||
}
|
||||
this.info = info;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -16,9 +16,15 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.jingle.transports.jingle_s5b;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
import static junit.framework.TestCase.assertNull;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
=======
|
||||
import static junit.framework.TestCase.assertNull;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
>>>>>>> js5btbFixes
|
||||
|
||||
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||
import org.jivesoftware.smack.test.util.TestUtils;
|
||||
|
@ -128,7 +134,11 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
JingleS5BTransport proxyErrorTransport = new JingleS5BTransportProvider()
|
||||
.parse(TestUtils.getParser(proxyError));
|
||||
assertNull(proxyErrorTransport.getDestinationAddress());
|
||||
<<<<<<< HEAD
|
||||
assertNotNull(proxyErrorTransport.getInfo());
|
||||
=======
|
||||
assertNotNull(candidateErrorTransport.getInfo());
|
||||
>>>>>>> js5btbFixes
|
||||
assertEquals("vj3hs98y", proxyErrorTransport.getStreamId());
|
||||
assertEquals(JingleS5BTransportInfo.ProxyError(),
|
||||
proxyErrorTransport.getInfo());
|
||||
|
@ -140,7 +150,11 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
"</transport>";
|
||||
JingleS5BTransport candidateUsedTransport = new JingleS5BTransportProvider()
|
||||
.parse(TestUtils.getParser(candidateUsed));
|
||||
<<<<<<< HEAD
|
||||
assertNotNull(candidateUsedTransport.getInfo());
|
||||
=======
|
||||
assertNotNull(candidateErrorTransport.getInfo());
|
||||
>>>>>>> js5btbFixes
|
||||
assertEquals(JingleS5BTransportInfo.CandidateUsed("hr65dqyd"),
|
||||
candidateUsedTransport.getInfo());
|
||||
assertEquals("hr65dqyd",
|
||||
|
@ -154,7 +168,11 @@ public class JingleS5BTransportTest extends SmackTestSuite {
|
|||
"</transport>";
|
||||
JingleS5BTransport candidateActivatedTransport = new JingleS5BTransportProvider()
|
||||
.parse(TestUtils.getParser(candidateActivated));
|
||||
<<<<<<< HEAD
|
||||
assertNotNull(candidateActivatedTransport.getInfo());
|
||||
=======
|
||||
assertNotNull(candidateErrorTransport.getInfo());
|
||||
>>>>>>> js5btbFixes
|
||||
assertEquals(JingleS5BTransportInfo.CandidateActivated("hr65dqyd"),
|
||||
candidateActivatedTransport.getInfo());
|
||||
assertEquals("hr65dqyd",
|
||||
|
|
Loading…
Reference in a new issue