1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-27 14:32:06 +01:00

Fix S5B test

This commit is contained in:
vanitasvitae 2017-08-13 17:22:26 +02:00
parent ef23aad7b2
commit 7744b244e8
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
4 changed files with 9 additions and 24 deletions

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smackx.jft; package org.jivesoftware.smackx.jft;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -126,7 +127,12 @@ public final class JingleFileTransferManager extends Manager implements JingleDe
return offer; return offer;
} }
public OutgoingFileRequestController requestFile(RemoteFile file) { public OutgoingFileOfferController sendStream(InputStream stream, String filename, FullJid to) {
//TODO: Implement
return null;
}
public OutgoingFileRequestController requestFile(RemoteFile file, FullJid from) {
JingleOutgoingFileRequest request = new JingleOutgoingFileRequest(file); JingleOutgoingFileRequest request = new JingleOutgoingFileRequest(file);
//TODO at some point. //TODO at some point.

View file

@ -376,17 +376,6 @@ 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(getStreamId());
activate.setMode(null);
activate.setType(IQ.Type.set);
activate.setTo(candidate.getStreamHost().getJID());
activate.setToActivate(getParent().getParent().getPeer());
activate.setFrom(getParent().getParent().getOurJid());
getParent().getParent().getJingleManager().getConnection().createStanzaCollectorAndSend(activate).nextResultOrThrow();
}
@Override @Override
public void handleSessionAccept(JingleContentTransportElement transportElement, XMPPConnection connection) { public void handleSessionAccept(JingleContentTransportElement transportElement, XMPPConnection connection) {
JingleS5BTransportElement transport = (JingleS5BTransportElement) transportElement; JingleS5BTransportElement transport = (JingleS5BTransportElement) transportElement;

View file

@ -17,7 +17,6 @@
package org.jivesoftware.smackx.jingle.transport.jingle_s5b; package org.jivesoftware.smackx.jingle.transport.jingle_s5b;
import java.io.IOException; import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.logging.Level; import java.util.logging.Level;
@ -97,6 +96,7 @@ public class JingleS5BTransportCandidate extends JingleTransportCandidate<Jingle
switch (getType()) { switch (getType()) {
case proxy: case proxy:
case direct:
Socks5Client client; Socks5Client client;
if (peersProposal) { if (peersProposal) {
String dstAddr = transport.getTheirDstAddr(); String dstAddr = transport.getTheirDstAddr();
@ -116,16 +116,6 @@ public class JingleS5BTransportCandidate extends JingleTransportCandidate<Jingle
this.socket = client.getSocket(timeout); this.socket = client.getSocket(timeout);
break; break;
case direct:
if (peersProposal) {
LOGGER.log(Level.INFO, "Connect to foreign direct candidate " + getCandidateId() + " Address: " + getStreamHost().getAddress() + ":" + getStreamHost().getPort());
this.socket = new Socket(getStreamHost().getAddress(), getStreamHost().getPort());
} else {
LOGGER.log(Level.INFO, "Connect to our direct candidate " + getCandidateId() + " at port " + getStreamHost().getPort());
this.socket = new ServerSocket(getStreamHost().getPort()).accept();
}
break;
default: default:
LOGGER.log(Level.INFO, "Unsupported candidate type: " + getType()); LOGGER.log(Level.INFO, "Unsupported candidate type: " + getType());
break; break;

View file

@ -197,7 +197,7 @@ public class JingleS5BTransportTest extends SmackTestSuite {
String candidateActivated = String candidateActivated =
"<transport xmlns='urn:xmpp:jingle:transports:s5b:1' sid='vj3hs98y'>" + "<transport xmlns='urn:xmpp:jingle:transports:s5b:1' sid='vj3hs98y'>" +
"<candidate-activated cid='hr65dqyd'/>" + "<activated cid='hr65dqyd'/>" +
"</transport>"; "</transport>";
JingleS5BTransportElement candidateActivatedTransport = new JingleS5BTransportProvider() JingleS5BTransportElement candidateActivatedTransport = new JingleS5BTransportProvider()
.parse(TestUtils.getParser(candidateActivated)); .parse(TestUtils.getParser(candidateActivated));