1 32 package net.sf.retrotranslator.runtime.java.net; 33 34 import java.io.InputStream ; 35 import java.net.*; 36 import junit.framework.TestCase; 37 38 41 public class _URLTestCase extends TestCase { 42 43 public void testOpenConnection() throws Exception { 44 URL resource = getClass().getResource(getClass().getSimpleName() + ".class"); 45 InputStream stream = resource.openConnection(Proxy.NO_PROXY).getInputStream(); 46 try { 47 assertTrue(stream.available() > 0); 48 } finally { 49 stream.close(); 50 } 51 } 52 53 public void testToURI() throws Exception { 54 URI uri = new URL("http", "localhost", 80, "/index.html").toURI(); 55 assertEquals("http://localhost:80/index.html", uri.toString()); 56 } 57 58 } | Popular Tags |