aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/testsuite/java.net
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2006-05-18 17:29:21 +0000
committerMark Wielaard <mark@gcc.gnu.org>2006-05-18 17:29:21 +0000
commit4f9533c7722fa07511a94d005227961f4a4dec23 (patch)
tree9f9c470de62ee62fba1331a396450d728d2b1fad /libjava/classpath/testsuite/java.net
parenteaec4980e139903ae9b274d1abcf3a13946603a8 (diff)
downloadgcc-4f9533c7722fa07511a94d005227961f4a4dec23.zip
gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.gz
gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.bz2
Imported GNU Classpath 0.90
Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887
Diffstat (limited to 'libjava/classpath/testsuite/java.net')
-rw-r--r--libjava/classpath/testsuite/java.net/DatagramSocketSendReceiveTest.java114
-rw-r--r--libjava/classpath/testsuite/java.net/DatagramSocketTest.java23
-rw-r--r--libjava/classpath/testsuite/java.net/SocketSendReceiveTest.java113
-rw-r--r--libjava/classpath/testsuite/java.net/SocketTest.java34
-rw-r--r--libjava/classpath/testsuite/java.net/URLTest.java23
-rw-r--r--libjava/classpath/testsuite/java.net/execute.exp7
6 files changed, 0 insertions, 314 deletions
diff --git a/libjava/classpath/testsuite/java.net/DatagramSocketSendReceiveTest.java b/libjava/classpath/testsuite/java.net/DatagramSocketSendReceiveTest.java
deleted file mode 100644
index b1614d2..0000000
--- a/libjava/classpath/testsuite/java.net/DatagramSocketSendReceiveTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-import java.net.*;
-
-/*
- * Start one thread for receiving a packet, wait for it to set up,
- * send a packet to it, and wait until it completes. Compare the
- * packet to make sure it came thru without errors.
- */
-
-public class DatagramSocketSendReceiveTest
- implements Runnable
-{
- public static final int port = 4000 + (int)(java.lang.Math.random() * 1000);
- public static final String message = "hello";
- public static int count = 0;
- public static String received;
-
- void send()
- throws Exception
- {
- DatagramSocket sender = new DatagramSocket();
- InetAddress local = sender.getLocalAddress();
- byte []message_bytes = message.getBytes();
-
- DatagramPacket packet = new DatagramPacket(message_bytes,
- message_bytes.length,
- local, port);
-
- sender.send(packet);
- sender.close();
- }
- void receive()
- throws Exception
- {
- DatagramSocket socket = new DatagramSocket(port);
- socket.setSoTimeout(10);
-
- byte[] buffer = new byte[100];
- DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
-
- synchronized(this) {
- notifyAll();
- }
-
- socket.receive(packet);
- socket.close();
-
- received = new String(buffer, 0, packet.getLength());
-
- count++;
- if ( message.length() != received.length() )
- throw new Exception("Receved "+ received.length()+
- " bytes but sent "+message.length() + " bytes");
-
- if ( ! message.equals(received) )
- throw new Exception("Receved \""+ received+
- "\" but sent \""+message + "\"");
-
- }
-
- public void run()
- {
- String name = Thread.currentThread().getName();
- if (name.equals("timer")) {
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e){}
- System.out.println("FAILED: timer triggered");
- System.exit(0);
- }
- try {
- receive();
- } catch (Exception e) {
- System.out.println("FAILED: receiver: " + e);
- System.exit(0);
- }
- }
- public static void main(String args[])
- {
- try {
- DatagramSocketSendReceiveTest sender =
- new DatagramSocketSendReceiveTest();
- DatagramSocketSendReceiveTest receiver =
- new DatagramSocketSendReceiveTest();
- Thread receiver_thread = new Thread(receiver);
-
- /* Make sure the test terminates even if it hangs on network */
- DatagramSocketSendReceiveTest timer = new DatagramSocketSendReceiveTest();
- Thread timer_thread = new Thread(timer, "timer");
- timer_thread.start();
-
- synchronized(receiver) {
- receiver_thread.start();
- receiver.wait();
- }
- try {
- sender.send();
- } catch (Exception e) {
- System.out.println("FAILED: sender: " + e);
- System.exit(0);
- }
- receiver_thread.join();
-
- if (0 == count)
- throw new Exception("Nothing received");
-
- System.out.println("PASSED: DatagramSocket send/receive count="+count+
- " message="+received);
- System.exit(0);
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- System.exit(0);
- }
- }
-}
diff --git a/libjava/classpath/testsuite/java.net/DatagramSocketTest.java b/libjava/classpath/testsuite/java.net/DatagramSocketTest.java
deleted file mode 100644
index 4ee0d49..0000000
--- a/libjava/classpath/testsuite/java.net/DatagramSocketTest.java
+++ /dev/null
@@ -1,23 +0,0 @@
-import java.net.*;
-
-public class DatagramSocketTest
-{
- public static void main(String args[])
- {
- try {
- DatagramSocket socket = new DatagramSocket();
-
- InetAddress local = socket.getLocalAddress();
-
- int port = socket.getLocalPort();
-
- socket.setSoTimeout(socket.getSoTimeout());
-
- socket.close();
-
- System.out.println("PASSED: new DatagramSocket()");
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- }
- }
-}
diff --git a/libjava/classpath/testsuite/java.net/SocketSendReceiveTest.java b/libjava/classpath/testsuite/java.net/SocketSendReceiveTest.java
deleted file mode 100644
index 15ab983..0000000
--- a/libjava/classpath/testsuite/java.net/SocketSendReceiveTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-import java.net.*;
-import java.io.*;
-
-/*
- * Start one thread for receiving a packet, wait for it to set up,
- * send a packet to it, and wait until it completes. Compare the
- * packet to make sure it came thru without errors.
- */
-
-public class SocketSendReceiveTest
- implements Runnable
-{
- public static final int port = 4000 + (int)(java.lang.Math.random() * 2000);
- public static final String message = "hello";
- public static int count = 0;
- public static String received;
-
- void send()
- throws Exception
- {
- InetAddress local = InetAddress.getLocalHost();
- Socket sender = new Socket(local, port);
- byte []message_bytes = message.getBytes();
-
- DataOutputStream out = new DataOutputStream(sender.getOutputStream());
- out.write(message_bytes, 0, message_bytes.length);
- out.flush();
- sender.close();
- }
- void receive()
- throws Exception
- {
- ServerSocket socket = new ServerSocket(port);
-
- synchronized(this) {
- notifyAll();
- }
-
- Socket connection = socket.accept();
- DataInputStream in = new DataInputStream(connection.getInputStream());
-
- byte[] buffer = new byte[100];
-
- int length = in.read(buffer);
-
- connection.close();
- socket.close();
-
- received = new String(buffer, 0, length);
-
- count++;
- if ( message.length() != received.length() )
- throw new Exception("Receved "+ received.length()+
- " bytes but sent "+message.length() + " bytes");
-
- if ( ! message.equals(received) )
- throw new Exception("Receved \""+ received+
- "\" but sent \""+message + "\"");
- }
-
- public void run()
- {
- String name = Thread.currentThread().getName();
- if (name.equals("timer")) {
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e){}
- System.out.println("FAILED: timer triggered");
- System.exit(0);
- }
- try {
- receive();
- } catch (Exception e) {
- System.out.println("FAILED: receiver (port "+port + "): " + e);
- System.exit(0);
- }
- }
- public static void main(String args[])
- {
- try {
- SocketSendReceiveTest sender = new SocketSendReceiveTest();
- SocketSendReceiveTest receiver = new SocketSendReceiveTest();
- Thread receiver_thread = new Thread(receiver);
-
- /* Make sure the test terminates even if it hangs on network */
- SocketSendReceiveTest timer = new SocketSendReceiveTest();
- Thread timer_thread = new Thread(timer, "timer");
- timer_thread.start();
-
- synchronized(receiver) {
- receiver_thread.start();
- receiver.wait();
- }
- try {
- sender.send();
- } catch (Exception e) {
- System.out.println("FAILED: receiver (port "+port + "): " + e);
- System.exit(0);
- }
- receiver_thread.join();
-
- if (0 == count)
- throw new Exception("Nothing received");
-
- System.out.println("PASSED: Socket send/receive count="+count+
- " message="+received);
- System.exit(0);
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- System.exit(0);
- }
- }
-}
diff --git a/libjava/classpath/testsuite/java.net/SocketTest.java b/libjava/classpath/testsuite/java.net/SocketTest.java
deleted file mode 100644
index 78a367b..0000000
--- a/libjava/classpath/testsuite/java.net/SocketTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-import java.net.*;
-
-public class SocketTest
-{
- public static void main(String args[])
- {
- try {
- Socket socket = new Socket("www.hungry.com", 80);
-
- InetAddress remote = socket.getInetAddress();
- InetAddress local = socket.getLocalAddress();
-
- int rport = socket.getPort();
- int lport = socket.getLocalPort();
-
- socket.setSoTimeout(socket.getSoTimeout());
- socket.setTcpNoDelay(socket.getTcpNoDelay());
- int linger = socket.getSoLinger();
- if (-1 != linger)
- socket.setSoLinger(true, linger);
- else
- socket.setSoLinger(false, 0);
-
- String socketString = socket.toString();
- if (null == socketString)
- throw new Exception("toString() failed");
-
- socket.close();
- System.out.println("PASSED: new Socket()" + socketString);
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- }
- }
-}
diff --git a/libjava/classpath/testsuite/java.net/URLTest.java b/libjava/classpath/testsuite/java.net/URLTest.java
deleted file mode 100644
index 026ea12..0000000
--- a/libjava/classpath/testsuite/java.net/URLTest.java
+++ /dev/null
@@ -1,23 +0,0 @@
-import java.net.*;
-import java.io.*;
-
-public class URLTest
-{
- public static void main(String args[])
- {
- try {
- URL url = new URL("http://www.hungry.com/");
- InputStream stream = url.openStream();
-
- int size = 0;
-
- while (-1 != stream.read()) { size++; }
-
- stream.close();
-
- System.out.println("PASSED: new URL() size=" + size );
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- }
- }
-}
diff --git a/libjava/classpath/testsuite/java.net/execute.exp b/libjava/classpath/testsuite/java.net/execute.exp
deleted file mode 100644
index 1092485..0000000
--- a/libjava/classpath/testsuite/java.net/execute.exp
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Author: Petter Reinholdtsen <pere@td.org.uit.no>
-
-# Load support procs
-load_lib java.exp
-
-test-java-source