proxy: do not call setTcpNoDelay() but instead flush the stream

This commit is contained in:
Florian Schmaus 2019-11-18 19:37:10 +01:00
parent 7afd1fdf46
commit 14cc0c1e41
2 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,6 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection {
socket.connect(new InetSocketAddress(proxy_host, proxy_port), timeout);
InputStream in = socket.getInputStream();
OutputStream out = socket.getOutputStream();
socket.setTcpNoDelay(true);
byte[] buf = new byte[1024];
int index = 0;
@ -88,6 +87,7 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection {
}
buf[index++] = 0;
out.write(buf, 0, index);
out.flush();
/*
The SOCKS server checks to see whether such a request should be granted

View File

@ -48,8 +48,6 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
InputStream in = socket.getInputStream();
OutputStream out = socket.getOutputStream();
socket.setTcpNoDelay(true);
byte[] buf = new byte[1024];
int index = 0;
@ -81,6 +79,7 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
buf[index++] = 2; // USERNAME/PASSWORD
out.write(buf, 0, index);
out.flush();
/*
The server selects from one of the methods given in METHODS, and
@ -205,6 +204,7 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {
buf[index++] = (byte) (port & 0xff);
out.write(buf, 0, index);
out.flush();
/*
The SOCKS request information is sent by the client as soon as it has