author | alanb |
Sat, 16 Mar 2019 19:44:12 +0000 | |
changeset 54155 | b5a73f22b2bd |
parent 53473 | 9366628d727b |
child 54689 | b28b7f631301 |
child 57268 | adcdd45830a0 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
2 |
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
package java.net; |
|
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
26 |
|
2 | 27 |
import java.io.IOException; |
28 |
import java.io.InputStream; |
|
29 |
import java.io.OutputStream; |
|
30 |
import java.io.BufferedOutputStream; |
|
31 |
import java.security.AccessController; |
|
50817
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47478
diff
changeset
|
32 |
|
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47478
diff
changeset
|
33 |
import jdk.internal.util.StaticProperty; |
7982
65f5328a67a2
6964547: Impossible to set useV4 in SocksSocketImpl
chegar
parents:
7668
diff
changeset
|
34 |
import sun.net.SocksProxy; |
31529
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
35 |
import sun.net.spi.DefaultProxySelector; |
2 | 36 |
import sun.net.www.ParseUtil; |
37 |
||
38 |
/** |
|
39 |
* SOCKS (V4 & V5) TCP socket implementation (RFC 1928). |
|
40 |
*/ |
|
41 |
||
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
42 |
class SocksSocketImpl extends DelegatingSocketImpl implements SocksConsts { |
2 | 43 |
private String server = null; |
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
44 |
private int serverPort = DEFAULT_PORT; |
2 | 45 |
private InetSocketAddress external_address; |
46 |
private boolean useV4 = false; |
|
47 |
private Socket cmdsock = null; |
|
48 |
private InputStream cmdIn = null; |
|
49 |
private OutputStream cmdOut = null; |
|
50 |
||
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
51 |
SocksSocketImpl(SocketImpl delegate) { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
52 |
super(delegate); |
2 | 53 |
} |
54 |
||
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
55 |
SocksSocketImpl(Proxy proxy, SocketImpl delegate) { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
56 |
super(delegate); |
2 | 57 |
SocketAddress a = proxy.address(); |
58 |
if (a instanceof InetSocketAddress) { |
|
59 |
InetSocketAddress ad = (InetSocketAddress) a; |
|
60 |
// Use getHostString() to avoid reverse lookups |
|
61 |
server = ad.getHostString(); |
|
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
62 |
serverPort = ad.getPort(); |
2 | 63 |
} |
31529
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
64 |
useV4 = useV4(proxy); |
2 | 65 |
} |
66 |
||
31529
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
67 |
private static boolean useV4(Proxy proxy) { |
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
68 |
if (proxy instanceof SocksProxy |
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
69 |
&& ((SocksProxy)proxy).protocolVersion() == 4) { |
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
70 |
return true; |
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
71 |
} |
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
72 |
return DefaultProxySelector.socksProxyVersion() == 4; |
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
73 |
} |
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
74 |
|
2 | 75 |
private synchronized void privilegedConnect(final String host, |
76 |
final int port, |
|
77 |
final int timeout) |
|
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
78 |
throws IOException |
2 | 79 |
{ |
80 |
try { |
|
81 |
AccessController.doPrivileged( |
|
29986
97167d851fc4
8078467: Update core libraries to use diamond with anonymous classes
darcy
parents:
29112
diff
changeset
|
82 |
new java.security.PrivilegedExceptionAction<>() { |
51 | 83 |
public Void run() throws IOException { |
2 | 84 |
superConnectServer(host, port, timeout); |
85 |
cmdIn = getInputStream(); |
|
86 |
cmdOut = getOutputStream(); |
|
87 |
return null; |
|
88 |
} |
|
89 |
}); |
|
90 |
} catch (java.security.PrivilegedActionException pae) { |
|
91 |
throw (IOException) pae.getException(); |
|
92 |
} |
|
93 |
} |
|
94 |
||
95 |
private void superConnectServer(String host, int port, |
|
96 |
int timeout) throws IOException { |
|
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
97 |
delegate.connect(new InetSocketAddress(host, port), timeout); |
2 | 98 |
} |
99 |
||
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
100 |
private static int remainingMillis(long deadlineMillis) throws IOException { |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
101 |
if (deadlineMillis == 0L) |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
102 |
return 0; |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
103 |
|
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
104 |
final long remaining = deadlineMillis - System.currentTimeMillis(); |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
105 |
if (remaining > 0) |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
106 |
return (int) remaining; |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
107 |
|
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
108 |
throw new SocketTimeoutException(); |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
109 |
} |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
110 |
|
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
111 |
private int readSocksReply(InputStream in, byte[] data, long deadlineMillis) throws IOException { |
2 | 112 |
int len = data.length; |
113 |
int received = 0; |
|
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
114 |
int originalTimeout = (int) getOption(SocketOptions.SO_TIMEOUT); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
115 |
try { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
116 |
while (received < len) { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
117 |
int count; |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
118 |
int remaining = remainingMillis(deadlineMillis); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
119 |
setOption(SocketOptions.SO_TIMEOUT, remaining); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
120 |
try { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
121 |
count = in.read(data, received, len - received); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
122 |
} catch (SocketTimeoutException e) { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
123 |
throw new SocketTimeoutException("Connect timed out"); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
124 |
} |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
125 |
if (count < 0) |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
126 |
throw new SocketException("Malformed reply from SOCKS server"); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
127 |
received += count; |
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
128 |
} |
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
129 |
} finally { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
130 |
setOption(SocketOptions.SO_TIMEOUT, originalTimeout); |
2 | 131 |
} |
132 |
return received; |
|
133 |
} |
|
134 |
||
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
135 |
private boolean authenticate(byte method, InputStream in, |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
136 |
BufferedOutputStream out, |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
137 |
long deadlineMillis) throws IOException { |
2 | 138 |
// No Authentication required. We're done then! |
139 |
if (method == NO_AUTH) |
|
140 |
return true; |
|
52499
768b1c612100
8213490: Networking area typos and inconsistencies cleanup
prappo
parents:
50817
diff
changeset
|
141 |
/* |
2 | 142 |
* User/Password authentication. Try, in that order : |
143 |
* - The application provided Authenticator, if any |
|
144 |
* - the user.name & no password (backward compatibility behavior). |
|
145 |
*/ |
|
146 |
if (method == USER_PASSW) { |
|
147 |
String userName; |
|
148 |
String password = null; |
|
149 |
final InetAddress addr = InetAddress.getByName(server); |
|
51 | 150 |
PasswordAuthentication pw = |
2 | 151 |
java.security.AccessController.doPrivileged( |
29986
97167d851fc4
8078467: Update core libraries to use diamond with anonymous classes
darcy
parents:
29112
diff
changeset
|
152 |
new java.security.PrivilegedAction<>() { |
51 | 153 |
public PasswordAuthentication run() { |
2 | 154 |
return Authenticator.requestPasswordAuthentication( |
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
155 |
server, addr, serverPort, "SOCKS5", "SOCKS authentication", null); |
2 | 156 |
} |
157 |
}); |
|
158 |
if (pw != null) { |
|
159 |
userName = pw.getUserName(); |
|
160 |
password = new String(pw.getPassword()); |
|
161 |
} else { |
|
50817
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47478
diff
changeset
|
162 |
userName = StaticProperty.userName(); |
2 | 163 |
} |
164 |
if (userName == null) |
|
165 |
return false; |
|
166 |
out.write(1); |
|
167 |
out.write(userName.length()); |
|
168 |
try { |
|
169 |
out.write(userName.getBytes("ISO-8859-1")); |
|
170 |
} catch (java.io.UnsupportedEncodingException uee) { |
|
171 |
assert false; |
|
172 |
} |
|
173 |
if (password != null) { |
|
174 |
out.write(password.length()); |
|
175 |
try { |
|
176 |
out.write(password.getBytes("ISO-8859-1")); |
|
177 |
} catch (java.io.UnsupportedEncodingException uee) { |
|
178 |
assert false; |
|
179 |
} |
|
180 |
} else |
|
181 |
out.write(0); |
|
182 |
out.flush(); |
|
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
183 |
byte[] data = new byte[2]; |
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
184 |
int i = readSocksReply(in, data, deadlineMillis); |
2 | 185 |
if (i != 2 || data[1] != 0) { |
186 |
/* RFC 1929 specifies that the connection MUST be closed if |
|
187 |
authentication fails */ |
|
188 |
out.close(); |
|
189 |
in.close(); |
|
190 |
return false; |
|
191 |
} |
|
192 |
/* Authentication succeeded */ |
|
193 |
return true; |
|
194 |
} |
|
195 |
return false; |
|
196 |
} |
|
197 |
||
198 |
private void connectV4(InputStream in, OutputStream out, |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
199 |
InetSocketAddress endpoint, |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
200 |
long deadlineMillis) throws IOException { |
2 | 201 |
if (!(endpoint.getAddress() instanceof Inet4Address)) { |
202 |
throw new SocketException("SOCKS V4 requires IPv4 only addresses"); |
|
203 |
} |
|
204 |
out.write(PROTO_VERS4); |
|
205 |
out.write(CONNECT); |
|
206 |
out.write((endpoint.getPort() >> 8) & 0xff); |
|
207 |
out.write((endpoint.getPort() >> 0) & 0xff); |
|
208 |
out.write(endpoint.getAddress().getAddress()); |
|
3450
2f08a8bb9b83
6801071: Remote sites can compromise user privacy and possibly hijack web sessions
chegar
parents:
715
diff
changeset
|
209 |
String userName = getUserName(); |
2 | 210 |
try { |
211 |
out.write(userName.getBytes("ISO-8859-1")); |
|
212 |
} catch (java.io.UnsupportedEncodingException uee) { |
|
213 |
assert false; |
|
214 |
} |
|
215 |
out.write(0); |
|
216 |
out.flush(); |
|
217 |
byte[] data = new byte[8]; |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
218 |
int n = readSocksReply(in, data, deadlineMillis); |
2 | 219 |
if (n != 8) |
220 |
throw new SocketException("Reply from SOCKS server has bad length: " + n); |
|
221 |
if (data[0] != 0 && data[0] != 4) |
|
222 |
throw new SocketException("Reply from SOCKS server has bad version"); |
|
223 |
SocketException ex = null; |
|
224 |
switch (data[1]) { |
|
225 |
case 90: |
|
226 |
// Success! |
|
227 |
external_address = endpoint; |
|
228 |
break; |
|
229 |
case 91: |
|
230 |
ex = new SocketException("SOCKS request rejected"); |
|
231 |
break; |
|
232 |
case 92: |
|
233 |
ex = new SocketException("SOCKS server couldn't reach destination"); |
|
234 |
break; |
|
235 |
case 93: |
|
236 |
ex = new SocketException("SOCKS authentication failed"); |
|
237 |
break; |
|
238 |
default: |
|
239 |
ex = new SocketException("Reply from SOCKS server contains bad status"); |
|
240 |
break; |
|
241 |
} |
|
242 |
if (ex != null) { |
|
243 |
in.close(); |
|
244 |
out.close(); |
|
245 |
throw ex; |
|
246 |
} |
|
247 |
} |
|
248 |
||
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
249 |
@Override |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
250 |
protected void connect(String host, int port) throws IOException { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
251 |
connect(new InetSocketAddress(host, port), 0); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
252 |
} |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
253 |
|
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
254 |
@Override |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
255 |
protected void connect(InetAddress address, int port) throws IOException { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
256 |
connect(new InetSocketAddress(address, port), 0); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
257 |
} |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
258 |
|
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
259 |
@Override |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
260 |
void setSocket(Socket soc) { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
261 |
delegate.socket = soc; |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
262 |
super.setSocket(soc); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
263 |
} |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
264 |
|
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
265 |
@Override |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
266 |
void setServerSocket(ServerSocket soc) { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
267 |
throw new InternalError("should not get here"); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
268 |
} |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
269 |
|
2 | 270 |
/** |
271 |
* Connects the Socks Socket to the specified endpoint. It will first |
|
272 |
* connect to the SOCKS proxy and negotiate the access. If the proxy |
|
273 |
* grants the connections, then the connect is successful and all |
|
274 |
* further traffic will go to the "real" endpoint. |
|
275 |
* |
|
19069 | 276 |
* @param endpoint the {@code SocketAddress} to connect to. |
2 | 277 |
* @param timeout the timeout value in milliseconds |
278 |
* @throws IOException if the connection can't be established. |
|
279 |
* @throws SecurityException if there is a security manager and it |
|
280 |
* doesn't allow the connection |
|
281 |
* @throws IllegalArgumentException if endpoint is null or a |
|
282 |
* SocketAddress subclass not supported by this socket |
|
283 |
*/ |
|
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
284 |
@Override |
2 | 285 |
protected void connect(SocketAddress endpoint, int timeout) throws IOException { |
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
286 |
final long deadlineMillis; |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
287 |
|
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
288 |
if (timeout == 0) { |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
289 |
deadlineMillis = 0L; |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
290 |
} else { |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
291 |
long finish = System.currentTimeMillis() + timeout; |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
292 |
deadlineMillis = finish < 0 ? Long.MAX_VALUE : finish; |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
293 |
} |
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
294 |
|
2 | 295 |
SecurityManager security = System.getSecurityManager(); |
296 |
if (endpoint == null || !(endpoint instanceof InetSocketAddress)) |
|
297 |
throw new IllegalArgumentException("Unsupported address type"); |
|
298 |
InetSocketAddress epoint = (InetSocketAddress) endpoint; |
|
299 |
if (security != null) { |
|
300 |
if (epoint.isUnresolved()) |
|
301 |
security.checkConnect(epoint.getHostName(), |
|
302 |
epoint.getPort()); |
|
303 |
else |
|
304 |
security.checkConnect(epoint.getAddress().getHostAddress(), |
|
305 |
epoint.getPort()); |
|
306 |
} |
|
307 |
if (server == null) { |
|
308 |
// This is the general case |
|
309 |
// server is not null only when the socket was created with a |
|
310 |
// specified proxy in which case it does bypass the ProxySelector |
|
51 | 311 |
ProxySelector sel = java.security.AccessController.doPrivileged( |
29986
97167d851fc4
8078467: Update core libraries to use diamond with anonymous classes
darcy
parents:
29112
diff
changeset
|
312 |
new java.security.PrivilegedAction<>() { |
51 | 313 |
public ProxySelector run() { |
2 | 314 |
return ProxySelector.getDefault(); |
315 |
} |
|
316 |
}); |
|
317 |
if (sel == null) { |
|
318 |
/* |
|
319 |
* No default proxySelector --> direct connection |
|
320 |
*/ |
|
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
321 |
delegate.connect(epoint, remainingMillis(deadlineMillis)); |
2 | 322 |
return; |
323 |
} |
|
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
324 |
URI uri; |
2 | 325 |
// Use getHostString() to avoid reverse lookups |
326 |
String host = epoint.getHostString(); |
|
52499
768b1c612100
8213490: Networking area typos and inconsistencies cleanup
prappo
parents:
50817
diff
changeset
|
327 |
// IPv6 literal? |
2 | 328 |
if (epoint.getAddress() instanceof Inet6Address && |
24685
215fa91e1b4c
8044461: Cleanup new Boolean and single character strings
rriggs
parents:
22276
diff
changeset
|
329 |
(!host.startsWith("[")) && (host.indexOf(':') >= 0)) { |
2 | 330 |
host = "[" + host + "]"; |
331 |
} |
|
332 |
try { |
|
333 |
uri = new URI("socket://" + ParseUtil.encodePath(host) + ":"+ epoint.getPort()); |
|
334 |
} catch (URISyntaxException e) { |
|
335 |
// This shouldn't happen |
|
336 |
assert false : e; |
|
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
337 |
uri = null; |
2 | 338 |
} |
339 |
Proxy p = null; |
|
340 |
IOException savedExc = null; |
|
341 |
java.util.Iterator<Proxy> iProxy = null; |
|
342 |
iProxy = sel.select(uri).iterator(); |
|
343 |
if (iProxy == null || !(iProxy.hasNext())) { |
|
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
344 |
delegate.connect(epoint, remainingMillis(deadlineMillis)); |
2 | 345 |
return; |
346 |
} |
|
347 |
while (iProxy.hasNext()) { |
|
348 |
p = iProxy.next(); |
|
29112
df7e4edb6566
7178362: Socket impls should ignore unsupported proxy types rather than throwing
coffeys
parents:
25859
diff
changeset
|
349 |
if (p == null || p.type() != Proxy.Type.SOCKS) { |
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
350 |
delegate.connect(epoint, remainingMillis(deadlineMillis)); |
2 | 351 |
return; |
352 |
} |
|
29112
df7e4edb6566
7178362: Socket impls should ignore unsupported proxy types rather than throwing
coffeys
parents:
25859
diff
changeset
|
353 |
|
2 | 354 |
if (!(p.address() instanceof InetSocketAddress)) |
29112
df7e4edb6566
7178362: Socket impls should ignore unsupported proxy types rather than throwing
coffeys
parents:
25859
diff
changeset
|
355 |
throw new SocketException("Unknown address type for proxy: " + p); |
2 | 356 |
// Use getHostString() to avoid reverse lookups |
357 |
server = ((InetSocketAddress) p.address()).getHostString(); |
|
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
358 |
serverPort = ((InetSocketAddress) p.address()).getPort(); |
31529
31d7d82b39ff
8129444: socksProxyVersion system property ignored for Socket(Proxy)
asmotrak
parents:
29986
diff
changeset
|
359 |
useV4 = useV4(p); |
2 | 360 |
|
361 |
// Connects to the SOCKS server |
|
362 |
try { |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
363 |
privilegedConnect(server, serverPort, remainingMillis(deadlineMillis)); |
2 | 364 |
// Worked, let's get outta here |
365 |
break; |
|
366 |
} catch (IOException e) { |
|
367 |
// Ooops, let's notify the ProxySelector |
|
368 |
sel.connectFailed(uri,p.address(),e); |
|
369 |
server = null; |
|
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
370 |
serverPort = -1; |
2 | 371 |
savedExc = e; |
372 |
// Will continue the while loop and try the next proxy |
|
373 |
} |
|
374 |
} |
|
375 |
||
376 |
/* |
|
377 |
* If server is still null at this point, none of the proxy |
|
378 |
* worked |
|
379 |
*/ |
|
380 |
if (server == null) { |
|
381 |
throw new SocketException("Can't connect to SOCKS proxy:" |
|
382 |
+ savedExc.getMessage()); |
|
383 |
} |
|
384 |
} else { |
|
385 |
// Connects to the SOCKS server |
|
386 |
try { |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
387 |
privilegedConnect(server, serverPort, remainingMillis(deadlineMillis)); |
2 | 388 |
} catch (IOException e) { |
389 |
throw new SocketException(e.getMessage()); |
|
390 |
} |
|
391 |
} |
|
392 |
||
21278 | 393 |
// cmdIn & cmdOut were initialized during the privilegedConnect() call |
2 | 394 |
BufferedOutputStream out = new BufferedOutputStream(cmdOut, 512); |
395 |
InputStream in = cmdIn; |
|
396 |
||
397 |
if (useV4) { |
|
398 |
// SOCKS Protocol version 4 doesn't know how to deal with |
|
399 |
// DOMAIN type of addresses (unresolved addresses here) |
|
400 |
if (epoint.isUnresolved()) |
|
401 |
throw new UnknownHostException(epoint.toString()); |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
402 |
connectV4(in, out, epoint, deadlineMillis); |
2 | 403 |
return; |
404 |
} |
|
405 |
||
406 |
// This is SOCKS V5 |
|
407 |
out.write(PROTO_VERS); |
|
408 |
out.write(2); |
|
409 |
out.write(NO_AUTH); |
|
410 |
out.write(USER_PASSW); |
|
411 |
out.flush(); |
|
412 |
byte[] data = new byte[2]; |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
413 |
int i = readSocksReply(in, data, deadlineMillis); |
2 | 414 |
if (i != 2 || ((int)data[0]) != PROTO_VERS) { |
415 |
// Maybe it's not a V5 sever after all |
|
416 |
// Let's try V4 before we give up |
|
417 |
// SOCKS Protocol version 4 doesn't know how to deal with |
|
418 |
// DOMAIN type of addresses (unresolved addresses here) |
|
419 |
if (epoint.isUnresolved()) |
|
420 |
throw new UnknownHostException(epoint.toString()); |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
421 |
connectV4(in, out, epoint, deadlineMillis); |
2 | 422 |
return; |
423 |
} |
|
424 |
if (((int)data[1]) == NO_METHODS) |
|
425 |
throw new SocketException("SOCKS : No acceptable methods"); |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
426 |
if (!authenticate(data[1], in, out, deadlineMillis)) { |
2 | 427 |
throw new SocketException("SOCKS : authentication failed"); |
428 |
} |
|
429 |
out.write(PROTO_VERS); |
|
430 |
out.write(CONNECT); |
|
431 |
out.write(0); |
|
432 |
/* Test for IPV4/IPV6/Unresolved */ |
|
433 |
if (epoint.isUnresolved()) { |
|
434 |
out.write(DOMAIN_NAME); |
|
435 |
out.write(epoint.getHostName().length()); |
|
436 |
try { |
|
437 |
out.write(epoint.getHostName().getBytes("ISO-8859-1")); |
|
438 |
} catch (java.io.UnsupportedEncodingException uee) { |
|
439 |
assert false; |
|
440 |
} |
|
441 |
out.write((epoint.getPort() >> 8) & 0xff); |
|
442 |
out.write((epoint.getPort() >> 0) & 0xff); |
|
443 |
} else if (epoint.getAddress() instanceof Inet6Address) { |
|
444 |
out.write(IPV6); |
|
445 |
out.write(epoint.getAddress().getAddress()); |
|
446 |
out.write((epoint.getPort() >> 8) & 0xff); |
|
447 |
out.write((epoint.getPort() >> 0) & 0xff); |
|
448 |
} else { |
|
449 |
out.write(IPV4); |
|
450 |
out.write(epoint.getAddress().getAddress()); |
|
451 |
out.write((epoint.getPort() >> 8) & 0xff); |
|
452 |
out.write((epoint.getPort() >> 0) & 0xff); |
|
453 |
} |
|
454 |
out.flush(); |
|
455 |
data = new byte[4]; |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
456 |
i = readSocksReply(in, data, deadlineMillis); |
2 | 457 |
if (i != 4) |
458 |
throw new SocketException("Reply from SOCKS server has bad length"); |
|
459 |
SocketException ex = null; |
|
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
460 |
int len; |
2 | 461 |
byte[] addr; |
462 |
switch (data[1]) { |
|
463 |
case REQUEST_OK: |
|
464 |
// success! |
|
465 |
switch(data[3]) { |
|
466 |
case IPV4: |
|
467 |
addr = new byte[4]; |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
468 |
i = readSocksReply(in, addr, deadlineMillis); |
2 | 469 |
if (i != 4) |
470 |
throw new SocketException("Reply from SOCKS server badly formatted"); |
|
471 |
data = new byte[2]; |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
472 |
i = readSocksReply(in, data, deadlineMillis); |
2 | 473 |
if (i != 2) |
474 |
throw new SocketException("Reply from SOCKS server badly formatted"); |
|
475 |
break; |
|
476 |
case DOMAIN_NAME: |
|
22276
7fc4c8b08e49
7100957: SOCKS proxying does not work with IPv6 connections
chegar
parents:
21278
diff
changeset
|
477 |
byte[] lenByte = new byte[1]; |
7fc4c8b08e49
7100957: SOCKS proxying does not work with IPv6 connections
chegar
parents:
21278
diff
changeset
|
478 |
i = readSocksReply(in, lenByte, deadlineMillis); |
7fc4c8b08e49
7100957: SOCKS proxying does not work with IPv6 connections
chegar
parents:
21278
diff
changeset
|
479 |
if (i != 1) |
7fc4c8b08e49
7100957: SOCKS proxying does not work with IPv6 connections
chegar
parents:
21278
diff
changeset
|
480 |
throw new SocketException("Reply from SOCKS server badly formatted"); |
7fc4c8b08e49
7100957: SOCKS proxying does not work with IPv6 connections
chegar
parents:
21278
diff
changeset
|
481 |
len = lenByte[0] & 0xFF; |
2 | 482 |
byte[] host = new byte[len]; |
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
483 |
i = readSocksReply(in, host, deadlineMillis); |
2 | 484 |
if (i != len) |
485 |
throw new SocketException("Reply from SOCKS server badly formatted"); |
|
486 |
data = new byte[2]; |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
487 |
i = readSocksReply(in, data, deadlineMillis); |
2 | 488 |
if (i != 2) |
489 |
throw new SocketException("Reply from SOCKS server badly formatted"); |
|
490 |
break; |
|
491 |
case IPV6: |
|
22276
7fc4c8b08e49
7100957: SOCKS proxying does not work with IPv6 connections
chegar
parents:
21278
diff
changeset
|
492 |
len = 16; |
2 | 493 |
addr = new byte[len]; |
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
494 |
i = readSocksReply(in, addr, deadlineMillis); |
2 | 495 |
if (i != len) |
496 |
throw new SocketException("Reply from SOCKS server badly formatted"); |
|
497 |
data = new byte[2]; |
|
5147
96642e83ad41
6223635: Code hangs at connect call even when Timeout is specified when using a socks proxy
chegar
parents:
3464
diff
changeset
|
498 |
i = readSocksReply(in, data, deadlineMillis); |
2 | 499 |
if (i != 2) |
500 |
throw new SocketException("Reply from SOCKS server badly formatted"); |
|
501 |
break; |
|
502 |
default: |
|
503 |
ex = new SocketException("Reply from SOCKS server contains wrong code"); |
|
504 |
break; |
|
505 |
} |
|
506 |
break; |
|
507 |
case GENERAL_FAILURE: |
|
508 |
ex = new SocketException("SOCKS server general failure"); |
|
509 |
break; |
|
510 |
case NOT_ALLOWED: |
|
511 |
ex = new SocketException("SOCKS: Connection not allowed by ruleset"); |
|
512 |
break; |
|
513 |
case NET_UNREACHABLE: |
|
514 |
ex = new SocketException("SOCKS: Network unreachable"); |
|
515 |
break; |
|
516 |
case HOST_UNREACHABLE: |
|
517 |
ex = new SocketException("SOCKS: Host unreachable"); |
|
518 |
break; |
|
519 |
case CONN_REFUSED: |
|
520 |
ex = new SocketException("SOCKS: Connection refused"); |
|
521 |
break; |
|
522 |
case TTL_EXPIRED: |
|
523 |
ex = new SocketException("SOCKS: TTL expired"); |
|
524 |
break; |
|
525 |
case CMD_NOT_SUPPORTED: |
|
526 |
ex = new SocketException("SOCKS: Command not supported"); |
|
527 |
break; |
|
528 |
case ADDR_TYPE_NOT_SUP: |
|
529 |
ex = new SocketException("SOCKS: address type not supported"); |
|
530 |
break; |
|
531 |
} |
|
532 |
if (ex != null) { |
|
533 |
in.close(); |
|
534 |
out.close(); |
|
535 |
throw ex; |
|
536 |
} |
|
537 |
external_address = epoint; |
|
538 |
} |
|
539 |
||
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
540 |
@Override |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
541 |
protected void listen(int backlog) { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
542 |
throw new InternalError("should not get here"); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
543 |
} |
2 | 544 |
|
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
545 |
@Override |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
546 |
protected void accept(SocketImpl s) { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
547 |
throw new InternalError("should not get here"); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
548 |
} |
2 | 549 |
|
550 |
/** |
|
19069 | 551 |
* Returns the value of this socket's {@code address} field. |
2 | 552 |
* |
19069 | 553 |
* @return the value of this socket's {@code address} field. |
2 | 554 |
* @see java.net.SocketImpl#address |
555 |
*/ |
|
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
556 |
@Override |
2 | 557 |
protected InetAddress getInetAddress() { |
558 |
if (external_address != null) |
|
559 |
return external_address.getAddress(); |
|
560 |
else |
|
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
561 |
return delegate.getInetAddress(); |
2 | 562 |
} |
563 |
||
564 |
/** |
|
19069 | 565 |
* Returns the value of this socket's {@code port} field. |
2 | 566 |
* |
19069 | 567 |
* @return the value of this socket's {@code port} field. |
2 | 568 |
* @see java.net.SocketImpl#port |
569 |
*/ |
|
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
570 |
@Override |
2 | 571 |
protected int getPort() { |
572 |
if (external_address != null) |
|
573 |
return external_address.getPort(); |
|
574 |
else |
|
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
575 |
return delegate.getPort(); |
2 | 576 |
} |
577 |
||
3051
9481bd560a57
6852108: Remove Preferences dependance from SocksSocketImpl
jccollet
parents:
715
diff
changeset
|
578 |
@Override |
2 | 579 |
protected void close() throws IOException { |
580 |
if (cmdsock != null) |
|
581 |
cmdsock.close(); |
|
582 |
cmdsock = null; |
|
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
583 |
delegate.close(); |
2 | 584 |
} |
585 |
||
3450
2f08a8bb9b83
6801071: Remote sites can compromise user privacy and possibly hijack web sessions
chegar
parents:
715
diff
changeset
|
586 |
private String getUserName() { |
53473
9366628d727b
8216986: Remove unused code from SocksSocketImpl
michaelm
parents:
52499
diff
changeset
|
587 |
return StaticProperty.userName(); |
3450
2f08a8bb9b83
6801071: Remote sites can compromise user privacy and possibly hijack web sessions
chegar
parents:
715
diff
changeset
|
588 |
} |
54155
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
589 |
|
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
590 |
@Override |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
591 |
void reset() { |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
592 |
throw new InternalError("should not get here"); |
b5a73f22b2bd
8220493: Prepare Socket/ServerSocket for alternative platform SocketImpl
alanb
parents:
53473
diff
changeset
|
593 |
} |
2 | 594 |
} |