diff --git a/src/main/java/eu/siacs/conversations/utils/SocksSocketFactory.java b/src/main/java/eu/siacs/conversations/utils/SocksSocketFactory.java index 62d4d7fe2..a2e8f2e85 100644 --- a/src/main/java/eu/siacs/conversations/utils/SocksSocketFactory.java +++ b/src/main/java/eu/siacs/conversations/utils/SocksSocketFactory.java @@ -52,7 +52,7 @@ public class SocksSocketFactory { return false; } - public static Socket createSocket(InetSocketAddress address, String destination, int port) throws IOException { + private static Socket createSocket(InetSocketAddress address, String destination, int port) throws IOException { Socket socket = new Socket(); try { socket.connect(address, Config.CONNECT_TIMEOUT * 1000); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java index e786036c7..e6b23ad18 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java @@ -120,7 +120,8 @@ public class JingleSocks5Transport extends JingleTransport { int destinationCount = inputStream.read(); final byte[] destination = new byte[destinationCount]; inputStream.read(destination); - final int port = inputStream.read(); + final byte[] port = new byte[2]; + inputStream.read(port); final String receivedDestination = new String(destination); final ByteBuffer response = ByteBuffer.allocate(7 + destination.length); final byte[] responseHeader; @@ -136,7 +137,7 @@ public class JingleSocks5Transport extends JingleTransport { response.put(responseHeader); response.put((byte) destination.length); response.put(destination); - response.putShort((short) port); + response.put(port); outputStream.write(response.array()); outputStream.flush(); if (success) {