equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
62 |
62 |
63 public ProxyCons() { |
63 public ProxyCons() { |
64 } |
64 } |
65 |
65 |
66 void test() throws Exception { |
66 void test() throws Exception { |
67 ServerSocket ss = new ServerSocket(0); |
67 InetAddress localHost = InetAddress.getLocalHost(); |
|
68 ServerSocket ss = new ServerSocket(); |
|
69 ss.bind(new InetSocketAddress(localHost, 0)); |
68 try { |
70 try { |
69 Server s = new Server(ss); |
71 Server s = new Server(ss); |
70 s.start(); |
72 s.start(); |
71 Socket sock = new Socket(Proxy.NO_PROXY); |
73 Socket sock = new Socket(Proxy.NO_PROXY); |
72 sock.connect(new InetSocketAddress("localhost", ss.getLocalPort())); |
74 sock.connect(new InetSocketAddress(localHost, ss.getLocalPort())); |
73 s.done(); |
75 s.done(); |
74 sock.close(); |
76 sock.close(); |
75 } catch (java.io.IOException e) { |
77 } catch (java.io.IOException e) { |
76 throw new RuntimeException(e); |
78 throw new RuntimeException(e); |
77 } finally { |
79 } finally { |