Now properly parsing IP bytes (0..255) without clashing with Java bytes (-128..127).
This commit is contained in:
parent
6566a1c6f6
commit
cc5f18bd11
|
@ -270,7 +270,7 @@ public class Socks5Proxy extends Proxy
|
|||
.put(Socks5.ADDRESS_TYPE_IPV4);
|
||||
for (int i = 1; i <= 4; ++i)
|
||||
{
|
||||
byteBuffer.put(Byte.parseByte(matcher.group(i)));
|
||||
byteBuffer.put((byte)Integer.parseInt(matcher.group(i)));
|
||||
}
|
||||
byteBuffer.putShort(port)
|
||||
.flip();
|
||||
|
|
|
@ -86,7 +86,7 @@ public class Socks5ProxyTest
|
|||
byte ip1 = 127;
|
||||
byte ip2 = 0;
|
||||
byte ip3 = 0;
|
||||
byte ip4 = 13;
|
||||
short ip4 = 255;
|
||||
String serverHost = ip1 + "." + ip2 + "." + ip3 + "." + ip4;
|
||||
int serverPort = proxyPort + 1; // Any port will do
|
||||
String method = "GET";
|
||||
|
@ -129,7 +129,7 @@ public class Socks5ProxyTest
|
|||
assertEquals(ip1, buffer.get());
|
||||
assertEquals(ip2, buffer.get());
|
||||
assertEquals(ip3, buffer.get());
|
||||
assertEquals(ip4, buffer.get());
|
||||
assertEquals((byte)ip4, buffer.get());
|
||||
assertEquals(serverPort, buffer.getShort() & 0xFFFF);
|
||||
|
||||
// Write connect response.
|
||||
|
|
Loading…
Reference in New Issue