equal
deleted
inserted
replaced
31 * @summary URLConnection doesn't support large files |
31 * @summary URLConnection doesn't support large files |
32 */ |
32 */ |
33 import java.net.*; |
33 import java.net.*; |
34 import java.io.*; |
34 import java.io.*; |
35 import sun.net.www.protocol.file.FileURLConnection; |
35 import sun.net.www.protocol.file.FileURLConnection; |
|
36 import static java.net.Proxy.NO_PROXY; |
36 |
37 |
37 public class B5052093 implements HttpCallback { |
38 public class B5052093 implements HttpCallback { |
38 private static TestHttpServer server; |
39 private static TestHttpServer server; |
39 private static long testSize = ((long) (Integer.MAX_VALUE)) + 2; |
40 private static long testSize = ((long) (Integer.MAX_VALUE)) + 2; |
40 |
41 |
66 public static void main(String[] args) throws Exception { |
67 public static void main(String[] args) throws Exception { |
67 InetAddress loopback = InetAddress.getLoopbackAddress(); |
68 InetAddress loopback = InetAddress.getLoopbackAddress(); |
68 server = new TestHttpServer(new B5052093(), 1, 10, loopback, 0); |
69 server = new TestHttpServer(new B5052093(), 1, 10, loopback, 0); |
69 try { |
70 try { |
70 URL url = new URL("http://" + server.getAuthority() + "/foo"); |
71 URL url = new URL("http://" + server.getAuthority() + "/foo"); |
71 URLConnection conn = url.openConnection(); |
72 URLConnection conn = url.openConnection(NO_PROXY); |
72 int i = conn.getContentLength(); |
73 int i = conn.getContentLength(); |
73 long l = conn.getContentLengthLong(); |
74 long l = conn.getContentLengthLong(); |
74 if (i != -1 || l != testSize) { |
75 if (i != -1 || l != testSize) { |
75 System.out.println("conn.getContentLength = " + i); |
76 System.out.println("conn.getContentLength = " + i); |
76 System.out.println("conn.getContentLengthLong = " + l); |
77 System.out.println("conn.getContentLengthLong = " + l); |