Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ CLASSES += src/malva/java/lang/reflect/FieldTest.class
CLASSES += src/malva/java/math/BigDecimalTest.class
CLASSES += src/malva/java/net/InetAddressTest.class
CLASSES += src/malva/java/net/NetworkInterfaceTest.class
CLASSES += src/malva/java/net/URLConnectionTest.class
CLASSES += src/malva/java/nio/DirectByteBufferTest.class
CLASSES += src/malva/java/text/DecimalFormatTest.class
CLASSES += src/malva/java/text/SimpleDateFormatTest.class
Expand Down
26 changes: 26 additions & 0 deletions src/malva/java/net/URLConnectionTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package malva.java.net;

import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;

import malva.TestCase;

public class URLConnectionTest extends TestCase {
private static void testConnect() throws Exception {
// Connect with unresolvable hostname
URL url = new URL("http", "anunresolvablehost", 80, "index.html");
final URLConnection connection = url.openConnection();
connection.setUseCaches(false);
assertThrows(new Block() {
@Override
public void run() throws Throwable {
connection.connect();
}
}, IOException.class);
}

public static void main(String[] args) throws Exception {
testConnect();
}
}