diff options
author | Alex Clayton <alex.clayton@isode.com> | 2016-02-08 12:30:12 (GMT) |
---|---|---|
committer | Alex Clayton <alex.clayton@isode.com> | 2016-02-16 11:02:39 (GMT) |
commit | 2ebf488dfee7156fbbe0b3d3eccebe13d86a8634 (patch) | |
tree | 8f0c873e2048e9f3a5bca51f358f60b21e690dd2 /src/com/isode/stroke/filetransfer/SOCKS5BytestreamClientSession.java | |
parent | 810abab2eb236c68c75025e383609d952af71e4f (diff) | |
download | stroke-2ebf488dfee7156fbbe0b3d3eccebe13d86a8634.zip stroke-2ebf488dfee7156fbbe0b3d3eccebe13d86a8634.tar.bz2 |
Add the FileTransfer tests
Add the missing FileTransfer tests to stroke. When porting the tests
I found some of them were failing and required changes to the classes
being tested to fix. Had to add a DummyNetworkEnvironment as well for
the OutgoingJingleFileTransferTest.
Test-information:
All unit tests pass.
Change-Id: Id511a556ef3a5d66e0e107f36f736db3bbb3a437
Diffstat (limited to 'src/com/isode/stroke/filetransfer/SOCKS5BytestreamClientSession.java')
-rw-r--r-- | src/com/isode/stroke/filetransfer/SOCKS5BytestreamClientSession.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/com/isode/stroke/filetransfer/SOCKS5BytestreamClientSession.java b/src/com/isode/stroke/filetransfer/SOCKS5BytestreamClientSession.java index 3e51b5f..18e4484 100644 --- a/src/com/isode/stroke/filetransfer/SOCKS5BytestreamClientSession.java +++ b/src/com/isode/stroke/filetransfer/SOCKS5BytestreamClientSession.java @@ -55,7 +55,7 @@ public class SOCKS5BytestreamClientSession extends SOCKS5AbstractBytestreamSessi private State state; - private ByteArray unprocessedData; + private final ByteArray unprocessedData = new ByteArray(); private ByteArray authenticateAddress; private int chunkSize; @@ -227,12 +227,9 @@ public class SOCKS5BytestreamClientSession extends SOCKS5AbstractBytestreamSessi private void authenticate() { logger_.fine("\n"); - SafeByteArray header = new SafeByteArray(new byte[]{0x05, 0x01, 0x00, 0x03}); - SafeByteArray message = header; - String destinationlength = Integer.toString(destination.length()); - message.append(new SafeByteArray(destinationlength)); - authenticateAddress = new ByteArray(destination); - message.append(authenticateAddress); + SafeByteArray message = new SafeByteArray(new byte[]{0x05, 0x01, 0x00, 0x03}); + message.append((byte)destination.length()); + message.append(destination); message.append(new SafeByteArray(new byte[]{0x00, 0x00})); // 2 byte for port connection.write(message); state = State.Authenticating; @@ -324,7 +321,9 @@ public class SOCKS5BytestreamClientSession extends SOCKS5AbstractBytestreamSessi private void closeConnection() { connectFinishedConnection.disconnect(); - dataWrittenConnection.disconnect(); + if (dataWrittenConnection != null) { + dataWrittenConnection.disconnect(); + } dataReadConnection.disconnect(); disconnectedConnection.disconnect(); connection.disconnect(); |