src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/websocket/WebSocketImpl.java
equal
deleted
inserted
replaced
158 sm.checkPermission(perm2); |
158 sm.checkPermission(perm2); |
159 } |
159 } |
160 } |
160 } |
161 |
161 |
162 static CompletableFuture<WebSocket> newInstanceAsync(BuilderImpl b) { |
162 static CompletableFuture<WebSocket> newInstanceAsync(BuilderImpl b) { |
163 URI uri = b.getUri(); |
163 Proxy proxy = proxyFor(b.getProxySelector(), b.getUri()); |
164 Proxy proxy = proxyFor(b.getProxySelector(), uri); |
|
165 try { |
164 try { |
166 checkPermissions(b, proxy); |
165 checkPermissions(b, proxy); |
167 } catch (Throwable throwable) { |
166 } catch (Throwable throwable) { |
168 return failedFuture(throwable); |
167 return failedFuture(throwable); |
169 } |
168 } |
170 |
169 |
171 Function<Result, WebSocket> newWebSocket = r -> { |
170 Function<Result, WebSocket> newWebSocket = r -> { |
172 WebSocketImpl ws = new WebSocketImpl(uri, |
171 WebSocketImpl ws = new WebSocketImpl(b.getUri(), |
173 r.subprotocol, |
172 r.subprotocol, |
174 r.channel, |
173 r.channel, |
175 b.getListener()); |
174 b.getListener()); |
176 // The order of calls might cause a subtle effects, like CF will be |
175 // The order of calls might cause a subtle effects, like CF will be |
177 // returned from the buildAsync _after_ onOpen has been signalled. |
176 // returned from the buildAsync _after_ onOpen has been signalled. |