summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--expectations/brokentests.txt7
-rw-r--r--expectations/knownfailures.txt16
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/net/InetAddressTest.java18
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/net/SocketTest.java2
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/SocketFactoryTest.java4
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketFactoryTest.java54
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java4
-rw-r--r--luni/src/main/java/java/lang/System.java7
-rw-r--r--luni/src/test/java/libcore/java/net/OldCookieHandlerTest.java73
-rw-r--r--luni/src/test/java/libcore/java/net/OldSocketTest.java5
-rw-r--r--luni/src/test/java/libcore/java/net/URLConnectionTest.java27
-rw-r--r--luni/src/test/java/org/apache/harmony/luni/tests/java/net/ContentHandlerFactoryTest.java145
-rw-r--r--luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java61
-rw-r--r--support/src/test/java/tests/support/Support_Configuration.java2
14 files changed, 98 insertions, 327 deletions
diff --git a/expectations/brokentests.txt b/expectations/brokentests.txt
index 5cebb63fe2..aa06985acf 100644
--- a/expectations/brokentests.txt
+++ b/expectations/brokentests.txt
@@ -142,13 +142,6 @@
]
},
{
- description: "This test affects tests that are run after this one due to caching in URLConnection.",
- result: EXEC_FAILED,
- names: [
- "org.apache.harmony.luni.tests.java.net.ContentHandlerFactoryTest#test_createContentHandler"
- ]
-},
-{
description: "Causes OutOfMemoryError to test finalization",
result: EXEC_FAILED,
names: [
diff --git a/expectations/knownfailures.txt b/expectations/knownfailures.txt
index 7f31c73216..1293b2796a 100644
--- a/expectations/knownfailures.txt
+++ b/expectations/knownfailures.txt
@@ -1464,6 +1464,7 @@
"com.squareup.okhttp.internal.spdy.SpdyConnectionTest",
"com.squareup.okhttp.internal.http.HttpOverHttp20Draft09Test",
"com.squareup.okhttp.internal.http.HttpOverSpdy3Test",
+ "com.squareup.okhttp.internal.http.ResponseCacheAdapterTest",
"com.squareup.okhttp.internal.http.URLConnectionTest#npnSetsProtocolHeader_SPDY_3",
"com.squareup.okhttp.internal.http.URLConnectionTest#npnSetsProtocolHeader_HTTP_2",
"com.squareup.okhttp.internal.http.URLConnectionTest#zeroLengthPost_SPDY_3",
@@ -1505,5 +1506,20 @@
names: [
"libcore.java.text.DecimalFormatSymbolsTest#test_getInstance_unknown_or_invalid_locale"
]
+},
+{
+ description: "libcore test failures on devices with a constrained (48mb) max heap size.",
+ bug : 18256012,
+ names: [
+ "com.squareup.okhttp.internal.spdy.Http20Draft09Test#tooLargeDataFrame",
+ "com.squareup.okhttp.internal.spdy.Spdy3Test#tooLargeDataFrame",
+ "libcore.java.util.zip.GZIPInputStreamTest#testLongMessage",
+ "libcore.java.util.zip.GZIPOutputStreamTest#testLongMessage",
+ "libcore.java.util.zip.ZipFileTest#testZip64Support",
+ "libcore.java.util.zip.ZipFileTest#testZipFileWithLotsOfEntries",
+ "libcore.java.util.zip.ZipInputStreamTest#testLongMessage",
+ "libcore.java.util.zip.ZipOutputStreamTest#testLongMessage"
+ ]
}
]
+
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/InetAddressTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/InetAddressTest.java
index 959f83cfcc..42f88c1242 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/InetAddressTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/InetAddressTest.java
@@ -24,31 +24,25 @@ import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
-import java.security.Permission;
import java.util.ArrayList;
import java.util.Enumeration;
import org.apache.harmony.testframework.serialization.SerializationTest;
import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
-import tests.support.Support_Configuration;
public class InetAddressTest extends junit.framework.TestCase {
/**
* java.net.InetAddress#getByName(String)
*/
- public void test_getByNameUnknownHostException() {
+ public void test_getByName_exceptionContainsUsefulMessage() {
// Related to HARMONY-5784
-
- // loop a few times to flex the negative cache paths
- for (int i = 0; i < 5; i++) {
- try {
- InetAddress.getByName("unknown.unknown.bad");
- fail("An UnknownHostException should have been thrown");
- } catch (UnknownHostException e) {
- assertTrue(e.getMessage().contains("unknown.unknown.bad"));
- }
+ try {
+ InetAddress.getByName("1.2.3.4hello");
+ fail();
+ } catch (UnknownHostException e) {
+ assertTrue(e.getMessage().contains("1.2.3.4hello"));
}
}
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/SocketTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/SocketTest.java
index 18d2cb2bac..4df92e2ee3 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/SocketTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/SocketTest.java
@@ -274,7 +274,7 @@ public class SocketTest extends junit.framework.TestCase {
public void test_connect_unknownhost() throws Exception {
Socket socket = new Socket();
try {
- socket.connect(new InetSocketAddress("unknownhost.invalid", 12345));
+ socket.connect(new InetSocketAddress("1.2.3.4hello", 12345));
fail();
} catch (UnknownHostException expected) {
}
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/SocketFactoryTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/SocketFactoryTest.java
index e939a9bed5..d566ee3d58 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/SocketFactoryTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/SocketFactoryTest.java
@@ -65,7 +65,7 @@ public class SocketFactoryTest extends TestCase {
assertTrue("Failed to create socket", s.getPort() == sport);
try {
- sf.createSocket("bla-bla", sport);
+ sf.createSocket("1.2.3.4hello", sport);
fail("UnknownHostException wasn't thrown");
} catch (UnknownHostException expected) {
}
@@ -180,7 +180,7 @@ public class SocketFactoryTest extends TestCase {
assertTrue("1: Failed to create socket", s.getPort() == sport);
try {
- sf.createSocket("bla-bla", sport, InetAddress.getLocalHost(), 0);
+ sf.createSocket("1.2.3.4hello", sport, InetAddress.getLocalHost(), 0);
fail("UnknownHostException wasn't thrown");
} catch (UnknownHostException expected) {
}
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketFactoryTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketFactoryTest.java
index 0d911162a6..e890032a0d 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketFactoryTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketFactoryTest.java
@@ -61,52 +61,42 @@ public class SSLSocketFactoryTest extends TestCase {
/**
* javax.net.ssl.SSLSocketFactory#createSocket(Socket s, String host, int port, boolean autoClose)
*/
- public void test_createSocket() {
+ public void test_createSocket() throws Exception {
SSLSocketFactory sf = (SSLSocketFactory)SSLSocketFactory.getDefault();
int sport = startServer("test_createSocket()");
int[] invalid = {
Integer.MIN_VALUE, -1, 65536, Integer.MAX_VALUE
};
- try {
- Socket st = new Socket("localhost", sport);
- Socket s = sf.createSocket(st, "localhost", sport, false);
- assertFalse(s.isClosed());
- } catch (Exception ex) {
- fail("Unexpected exception " + ex);
- }
- try {
- Socket st = new Socket("localhost", sport);
- Socket s = sf.createSocket(st, "localhost", sport, true);
- s.close();
- assertTrue(st.isClosed());
- } catch (Exception ex) {
- fail("Unexpected exception " + ex);
- }
+
+
+ Socket st = new Socket("localhost", sport);
+ Socket s = sf.createSocket(st, "localhost", sport, false);
+ assertFalse(s.isClosed());
+
+ st = new Socket("localhost", sport);
+ s = sf.createSocket(st, "localhost", sport, true);
+ s.close();
+ assertTrue(st.isClosed());
+
try {
sf.createSocket(null, "localhost", sport, true);
- fail("IOException wasn't thrown");
- } catch (IOException ioe) {
- // expected
- } catch (NullPointerException e) {
- // expected
+ fail();
+ } catch (NullPointerException expected) {
}
+
for (int i = 0; i < invalid.length; i++) {
try {
- Socket s = sf.createSocket(new Socket(), "localhost", 1080, false);
- fail("IOException wasn't thrown");
- } catch (IOException ioe) {
- // expected
+ s = sf.createSocket(new Socket(), "localhost", 1080, false);
+ fail();
+ } catch (IOException expected) {
}
}
try {
- Socket st = new Socket("bla-bla", sport);
- Socket s = sf.createSocket(st, "bla-bla", sport, false);
- fail("UnknownHostException wasn't thrown: " + "bla-bla");
- } catch (UnknownHostException uhe) {
- // expected
- } catch (Exception e) {
- fail(e + " was thrown instead of UnknownHostException");
+ st = new Socket("1.2.3.4hello", sport);
+ s = sf.createSocket(st, "1.2.3.4hello", sport, false);
+ fail();
+ } catch (UnknownHostException expected) {
}
}
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java
index b4cbde201b..950d534b73 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java
@@ -158,7 +158,7 @@ public class SSLSocketTest extends TestCase {
}
try {
- getSSLSocket("bla-bla", sport);
+ getSSLSocket("1.2.3.4hello", sport);
fail();
} catch (UnknownHostException expected) {
}
@@ -199,7 +199,7 @@ public class SSLSocketTest extends TestCase {
}
try {
- getSSLSocket("bla-bla", sport, InetAddress.getLocalHost(), 0);
+ getSSLSocket("1.2.3.4hello", sport, InetAddress.getLocalHost(), 0);
fail();
} catch (UnknownHostException expected) {
}
diff --git a/luni/src/main/java/java/lang/System.java b/luni/src/main/java/java/lang/System.java
index 68af967651..55ca762ad7 100644
--- a/luni/src/main/java/java/lang/System.java
+++ b/luni/src/main/java/java/lang/System.java
@@ -830,8 +830,7 @@ public final class System {
* Returns the value of a particular system property or {@code null} if no
* such property exists.
*
- * <p>The following properties are always provided by the Dalvik VM <b>and
- * cannot be modified</b>:
+ * <p>The following properties are always provided by the Dalvik VM:</p>
* <p><table BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
* <tr BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
* <td><b>Name</b></td> <td><b>Meaning</b></td> <td><b>Example</b></td></tr>
@@ -872,8 +871,8 @@ public final class System {
*
* </table>
*
- * <p>It is an error to override anyone of these properties. Any attempt to
- * do so will leave their values unchanged.
+ * <p> All of the above properties except for {@code user.home} and {@code java.io.tmpdir}
+ * <b>cannot be modified</b>. Any attempt to change them will be a no-op.
*
* @param propertyName
* the name of the system property to look up.
diff --git a/luni/src/test/java/libcore/java/net/OldCookieHandlerTest.java b/luni/src/test/java/libcore/java/net/OldCookieHandlerTest.java
index 249c32660b..0e11d50c37 100644
--- a/luni/src/test/java/libcore/java/net/OldCookieHandlerTest.java
+++ b/luni/src/test/java/libcore/java/net/OldCookieHandlerTest.java
@@ -16,6 +16,9 @@
package libcore.java.net;
+import com.google.mockwebserver.MockResponse;
+import com.google.mockwebserver.MockWebServer;
+
import java.io.IOException;
import java.net.CookieHandler;
import java.net.URI;
@@ -27,65 +30,57 @@ import tests.support.Support_Configuration;
public class OldCookieHandlerTest extends TestCase {
- URI getURI, putURI;
- String link = "http://" + Support_Configuration.SpecialInetTestAddress + "/";
- boolean isGetCalled = false;
- boolean isPutCalled = false;
- boolean completedSuccessfully = false;
-
public void test_CookieHandler() {
assertNull(CookieHandler.getDefault());
}
- public void test_get_put() {
+ public void test_get_put() throws Exception {
MockCookieHandler mch = new MockCookieHandler();
CookieHandler defaultHandler = CookieHandler.getDefault();
- CookieHandler.setDefault(mch);
-
- class TestThread extends Thread {
- public void run() {
- try {
- URL url = new URL(link);
- URLConnection conn = url.openConnection();
- conn.getContent();
- url = new URL(link);
- conn = url.openConnection();
- conn.getContent();
- completedSuccessfully = true;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
try {
- TestThread thread = new TestThread();
+ CookieHandler.setDefault(mch);
- thread.start();
- try {
- thread.join();
- } catch (InterruptedException e) {
- fail("InterruptedException was thrown.");
- }
+ MockWebServer server = new MockWebServer();
+ server.play();
+ server.enqueue(new MockResponse().addHeader("Set-Cookie2: a=\"android\"; "
+ + "Comment=\"this cookie is delicious\"; "
+ + "CommentURL=\"http://google.com/\"; "
+ + "Discard; "
+ + "Domain=\"" + server.getCookieDomain() + "\"; "
+ + "Max-Age=\"60\"; "
+ + "Path=\"/path\"; "
+ + "Port=\"80,443," + server.getPort() + "\"; "
+ + "Secure; "
+ + "Version=\"1\""));
- assertTrue(isGetCalled);
- assertTrue(isPutCalled);
- assertTrue(completedSuccessfully);
+ URLConnection connection = server.getUrl("/path/foo").openConnection();
+ connection.getContent();
+
+ assertTrue(mch.wasGetCalled());
+ assertTrue(mch.wasPutCalled());
} finally {
CookieHandler.setDefault(defaultHandler);
}
}
- class MockCookieHandler extends CookieHandler {
+ private static class MockCookieHandler extends CookieHandler {
+ private boolean getCalled = false;
+ private boolean putCalled = false;
public Map get(URI uri, Map requestHeaders) throws IOException {
- getURI = uri;
- isGetCalled = true;
+ getCalled = true;
return requestHeaders;
}
public void put(URI uri, Map responseHeaders) throws IOException {
- putURI = uri;
- isPutCalled = true;
+ putCalled = true;
+ }
+
+ public boolean wasGetCalled() {
+ return getCalled;
+ }
+ public boolean wasPutCalled() {
+ return putCalled;
}
}
}
diff --git a/luni/src/test/java/libcore/java/net/OldSocketTest.java b/luni/src/test/java/libcore/java/net/OldSocketTest.java
index b0125acc15..80bee6989b 100644
--- a/luni/src/test/java/libcore/java/net/OldSocketTest.java
+++ b/luni/src/test/java/libcore/java/net/OldSocketTest.java
@@ -119,9 +119,10 @@ public class OldSocketTest extends OldSocketTestCase {
}
public void test_ConstructorLjava_lang_StringILjava_net_InetAddressI2() throws IOException {
- Socket s1 = new Socket("www.google.com", 80, null, 0);
+ int sport = startServer("Cons String,I,InetAddress,I");
+ Socket s1 = new Socket(InetAddress.getLocalHost(), sport, null, 0);
try {
- Socket s2 = new Socket("www.google.com", 80, null, s1.getLocalPort());
+ Socket s2 = new Socket(InetAddress.getLocalHost(), sport, null, s1.getLocalPort());
try {
s2.close();
} catch (IOException ignored) {
diff --git a/luni/src/test/java/libcore/java/net/URLConnectionTest.java b/luni/src/test/java/libcore/java/net/URLConnectionTest.java
index 40c9f5ef6c..b672b1977c 100644
--- a/luni/src/test/java/libcore/java/net/URLConnectionTest.java
+++ b/luni/src/test/java/libcore/java/net/URLConnectionTest.java
@@ -641,42 +641,32 @@ public final class URLConnectionTest extends AbstractResourceLeakageDetectorTest
* Tolerate bad https proxy response when using HttpResponseCache. http://b/6754912
*/
public void testConnectViaHttpProxyToHttpsUsingBadProxyAndHttpResponseCache() throws Exception {
- ProxyConfig proxyConfig = ProxyConfig.PROXY_SYSTEM_PROPERTY;
-
TestSSLContext testSSLContext = TestSSLContext.create();
initResponseCache();
server.useHttps(testSSLContext.serverContext.getSocketFactory(), true);
+
+ // The inclusion of a body in the response to the CONNECT is key to reproducing b/6754912.
MockResponse badProxyResponse = new MockResponse()
.setSocketPolicy(SocketPolicy.UPGRADE_TO_SSL_AT_END)
.clearHeaders()
- .setBody("bogus proxy connect response content"); // Key to reproducing b/6754912
+ .setBody("bogus proxy connect response content");
- // We enqueue the bad response twice because the connection will
- // be retried with TLS_MODE_COMPATIBLE after the first connection
- // fails.
- server.enqueue(badProxyResponse);
server.enqueue(badProxyResponse);
+ server.enqueue(new MockResponse().setBody("response"));
server.play();
URL url = new URL("https://android.com/foo");
+ ProxyConfig proxyConfig = ProxyConfig.PROXY_SYSTEM_PROPERTY;
HttpsURLConnection connection = (HttpsURLConnection) proxyConfig.connect(server, url);
connection.setSSLSocketFactory(testSSLContext.clientContext.getSocketFactory());
-
- try {
- connection.connect();
- fail();
- } catch (SSLHandshakeException expected) {
- // Thrown when the connect causes SSLSocket.startHandshake() to throw
- // when it sees the "bogus proxy connect response content"
- // instead of a ServerHello handshake message.
- }
+ connection.setHostnameVerifier(new RecordingHostnameVerifier());
+ assertContent("response", connection);
RecordedRequest connect = server.takeRequest();
- assertEquals("Connect line failure on proxy",
- "CONNECT android.com:443 HTTP/1.1", connect.getRequestLine());
+ assertEquals("CONNECT android.com:443 HTTP/1.1", connect.getRequestLine());
assertContains(connect.getHeaders(), "Host: android.com");
}
@@ -965,6 +955,7 @@ public final class URLConnectionTest extends AbstractResourceLeakageDetectorTest
RecordedRequest request = server.takeRequest();
assertContains(request.getHeaders(), "Accept-Encoding: gzip");
+ assertEquals("gzip", connection.getContentEncoding());
}
public void testGzipAndConnectionReuseWithFixedLength() throws Exception {
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/ContentHandlerFactoryTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/ContentHandlerFactoryTest.java
deleted file mode 100644
index f3d5518415..0000000000
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/ContentHandlerFactoryTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.apache.harmony.luni.tests.java.net;
-
-import junit.framework.TestCase;
-
-import tests.support.Support_Configuration;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.net.ContentHandler;
-import java.net.ContentHandlerFactory;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-
-public class ContentHandlerFactoryTest extends TestCase {
-
- ContentHandlerFactory oldFactory = null;
- Field factoryField = null;
-
- boolean isTestable = false;
-
- boolean isGetContentCalled = false;
- boolean isCreateContentHandlerCalled = false;
-
- // SideEffect: This test affects tests that are run after this one.
- // The reason are side effects due to caching in URLConnection.
- // Maybe this test needs to be run in isolation.
- public void test_createContentHandler() throws IOException {
-
- TestContentHandlerFactory factory = new TestContentHandlerFactory();
-
- if(isTestable) {
-
- assertFalse(isCreateContentHandlerCalled);
-
- URL url = new URL("http://" +
- Support_Configuration.SpecialInetTestAddress);
-
- URLConnection.setContentHandlerFactory(factory);
-
- URLConnection con = url.openConnection();
-
- try {
- con.getContent();
- assertTrue(isCreateContentHandlerCalled);
- assertTrue(isGetContentCalled);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- isGetContentCalled = false;
-
- try {
- con.getContent(new Class[] {});
- assertTrue(isGetContentCalled);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- try {
- con.setContentHandlerFactory(factory);
- fail("java.lang.Error was not thrown.");
- } catch(java.lang.Error e) {
- //expected
- }
-
- try {
- con.setContentHandlerFactory(null);
- fail("java.lang.Error was not thrown.");
- } catch(java.lang.Error e) {
- //expected
- }
-
- } else {
- ContentHandler ch = factory.createContentHandler("text/plain");
- URL url;
- try {
- url = new URL("http://" +
- Support_Configuration.SpecialInetTestAddress);
- assertNotNull(ch.getContent(url.openConnection()));
- } catch (MalformedURLException e) {
- fail("MalformedURLException was thrown: " + e.getMessage());
- } catch (IOException e) {
- fail("IOException was thrown.");
- }
- }
- }
-
- public void setUp() {
- Field [] fields = URLConnection.class.getDeclaredFields();
- int counter = 0;
- for (Field field : fields) {
- if (ContentHandlerFactory.class.equals(field.getType())) {
- counter++;
- factoryField = field;
- }
- }
-
- if(counter == 1) {
-
- isTestable = true;
-
- factoryField.setAccessible(true);
- try {
- oldFactory = (ContentHandlerFactory) factoryField.get(null);
- } catch (IllegalArgumentException e) {
- fail("IllegalArgumentException was thrown during setUp: "
- + e.getMessage());
- } catch (IllegalAccessException e) {
- fail("IllegalAccessException was thrown during setUp: "
- + e.getMessage());
- }
- }
- }
-
- public void tearDown() {
- if(isTestable) {
- try {
- factoryField.set(null, oldFactory);
- } catch (IllegalArgumentException e) {
- fail("IllegalArgumentException was thrown during tearDown: "
- + e.getMessage());
- } catch (IllegalAccessException e) {
- fail("IllegalAccessException was thrown during tearDown: "
- + e.getMessage());
- }
- }
- }
-
- public class TestContentHandler extends ContentHandler {
-
- public Object getContent(URLConnection u) {
- isGetContentCalled = true;
- return null;
- }
- }
-
- public class TestContentHandlerFactory implements ContentHandlerFactory {
-
- public ContentHandler createContentHandler(String mimetype) {
- isCreateContentHandlerCalled = true;
- return new TestContentHandler();
- }
- }
-}
diff --git a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java
index d52b0339be..5307cf473a 100644
--- a/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java
+++ b/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java
@@ -438,39 +438,6 @@ public class URLConnectionTest extends TestCase {
}
/**
- * @throws IOException
- * {@link java.net.URLConnection#getContentEncoding()}
- */
- // broken test - Fails in CTS, passes in CoreTestRunner
- public void test_getContentEncoding() throws IOException {
- // faulty setup
- try {
-
- fileURLCon.getContentEncoding();
- fail("Exception expected");
- } catch (Throwable e) {
- //ok
- }
-
- // positive case
-
- URL url = new URL("http://www.amazon.com/");
-
- URLConnection con = url.openConnection();
- con.setRequestProperty("Accept-Encoding", "gzip");
- con.connect();
-
- assertEquals(con.getContentEncoding(), "gzip");
-
-
- uc2.setRequestProperty("Accept-Encoding", "bla");
- uc2.connect();
-
- assertNull(uc2.getContentEncoding());
-
- }
-
- /**
* {@link java.net.URLConnection#getContentLength()}
*/
public void test_getContentLength() throws Exception {
@@ -833,34 +800,6 @@ public class URLConnectionTest extends TestCase {
}
}
- /**
- * @throws IOException
- * {@link java.net.URLConnection#getLastModified()}
- */
- public void test_getLastModified() throws IOException {
-
- URL url4 = new URL(Support_Configuration.hTTPURLwLastModified);
- URLConnection uc4 = url4.openConnection();
-
- uc4.connect();
-
- if (uc4.getLastModified() == 0) {
- System.out
- .println("WARNING: Server does not support 'Last-Modified', test_getLastModified() not run");
- return;
- }
-
- long millis = uc4.getHeaderFieldDate("Last-Modified", 0);
-
- assertEquals(
- "Returned wrong getLastModified value. Wanted: "
- + " got: " + uc4.getLastModified(),
- millis, uc4.getLastModified());
-
-
- ((HttpURLConnection) uc).disconnect();
- }
-
public void test_getOutputStream_failAfterDisconnect() throws IOException {
((HttpURLConnection) uc2).disconnect();
diff --git a/support/src/test/java/tests/support/Support_Configuration.java b/support/src/test/java/tests/support/Support_Configuration.java
index 9cb617dfb9..313a44890d 100644
--- a/support/src/test/java/tests/support/Support_Configuration.java
+++ b/support/src/test/java/tests/support/Support_Configuration.java
@@ -91,8 +91,6 @@ public class Support_Configuration {
// than one addresses returned for this host name as needed by a test
// END android-changed
- public static String hTTPURLwLastModified = "http://www.php.net/manual/en/function.explode.php";
-
public static int SpecialInetTestAddressNumber = 4;
/**