summaryrefslogtreecommitdiff
path: root/libjava/classpath/test/java.net/ClientSocket.java
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-18 17:29:21 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-18 17:29:21 +0000
commit64089cc9f030d8ef7972adb5d117e0b23f47d62b (patch)
tree9f9c470de62ee62fba1331a396450d728d2b1fad /libjava/classpath/test/java.net/ClientSocket.java
parent96034e28360d660d7a7708807fcbc4b519574d8e (diff)
downloadgcc-64089cc9f030d8ef7972adb5d117e0b23f47d62b.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113887 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/test/java.net/ClientSocket.java')
-rw-r--r--libjava/classpath/test/java.net/ClientSocket.java189
1 files changed, 0 insertions, 189 deletions
diff --git a/libjava/classpath/test/java.net/ClientSocket.java b/libjava/classpath/test/java.net/ClientSocket.java
deleted file mode 100644
index 53a498b34e9..00000000000
--- a/libjava/classpath/test/java.net/ClientSocket.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/* A class to test my client TCP socket implementation */
-
-import java.net.*;
-import java.io.*;
-
-public class ClientSocket extends Object
-{
-public static void
-main(String[] argv) throws IOException
-{
- System.out.println("Starting client stream socket test");
-
- /* Simple connection and read test */
- System.out.println("Test 1: Connection to daytime port on local host");
- try
- {
- InetAddress addr = InetAddress.getByName("127.0.0.1");
-
- Socket s = new Socket(addr, 13);
-
- InputStream is = s.getInputStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
-
- for (String str = br.readLine(); ; str = br.readLine())
- {
- if (str == null)
- break;
- System.out.println(str);
- }
- s.close();
- System.out.println("PASSED: daytime test");
- }
- catch(IOException e)
- {
- System.out.println("FAILED: daytime test: " + e);
- }
-
- /* Simple connection refused test */
- System.out.println("Test 2: Connection refused test");
- try
- {
- InetAddress addr = InetAddress.getByName("127.0.0.1");
-
- Socket s = new Socket(addr, 47);
- s.close();
-
- System.out.print("WARNING: Cannot perform connection refused test");
- System.out.println(" because someone is listening on localhost:47");
- }
- catch(IOException e)
- {
- System.out.println("PASSED: connection refused test: " + e.getMessage());
- }
-
- /* Socket attributes test */
- System.out.println("Test 3: Connection attributes");
- try
- {
- Socket s = new Socket("www.netscape.com", 80);
-
- String laddr = s.getLocalAddress().getHostName();
- int lport = s.getLocalPort();
- String raddr = s.getInetAddress().getHostName();
- int rport = s.getPort();
-
- System.out.println("Local Address is: " + laddr);
- System.out.println("Local Port is: " + lport);
- System.out.println("Remote Address is: " + raddr);
- System.out.println("Remote Port is: " + rport);
- System.out.println("Socket.toString is: " + s);
-
- if ( (laddr == null) ||
- ((lport < 0) || (lport > 65535)) ||
- (raddr.indexOf("netscape.com") == -1) ||
- (rport != 80))
- System.out.println("FAILED: connection attribute test");
- else
- System.out.println("PASSED: connection attribute test");
-
- s.close();
- }
- catch(IOException e)
- {
- System.out.println("FAILED: connection attributes test: " + e.getMessage());
- }
-
- /* Socket options test */
- System.out.println("Test 4: Socket options");
- Socket s = new Socket("127.0.0.1", 23);
-
- try
- {
- // SO_TIMEOUT
- System.out.println("SO_TIMEOUT = " + s.getSoTimeout());
- System.out.println("Setting SO_TIMEOUT to 142");
- s.setSoTimeout(142);
- System.out.println("SO_TIMEOUT = " + s.getSoTimeout());
- System.out.println("Setting SO_TIMEOUT to 0");
- s.setSoTimeout(0);
- System.out.println("SO_TIMEOUT = " + s.getSoTimeout());
- }
- catch (IOException e)
- {
- System.out.println("WARNING: SO_TIMEOUT problem: " + e.getMessage());
- System.out.println("This is ok on Linux");
- }
- try
- {
- // Try TCP_NODELAY
- System.out.println("TCP_NODELAY = " + s.getTcpNoDelay());
- System.out.println("Setting TCP_NODELAY to true");
- s.setTcpNoDelay(true);
- System.out.println("TCP_NODELAY = " + s.getTcpNoDelay());
- System.out.println("Setting TCP_NODELAY to false");
- s.setTcpNoDelay(false);
- System.out.println("TCP_NODELAY = " + s.getTcpNoDelay());
-
- // Try SO_LINGER
- System.out.println("SO_LINGER = " + s.getSoLinger());
- System.out.println("Setting SO_LINGER to 100");
- s.setSoLinger(true, 100);
- System.out.println("SO_LINGER = " + s.getSoLinger());
- System.out.println("Setting SO_LINGER to off");
- s.setSoLinger(false, 0);
- System.out.println("SO_LINGER = " + s.getSoLinger());
-
- System.out.println("PASSED: socket options test");
- }
- catch(IOException e)
- {
- System.out.println("FAILED: socket options test: " + e.getMessage());
- }
- s.close();
-
- /* Simple read/write test */
- System.out.println("Test 5: Simple read/write test");
- try
- {
- System.out.println("Downloading the Transmeta homepage");
- s = new Socket("www.transmeta.com", 80);
-
- BufferedReader in = new BufferedReader(new
- InputStreamReader(s.getInputStream()));
- PrintWriter out = new PrintWriter(new
- OutputStreamWriter(s.getOutputStream()));
-
- out.print("GET /\r\n");
- out.flush();
-
- for (String str = in.readLine(); ; str = in.readLine())
- {
- if (str == null)
- break;
- System.out.println(str);
- }
-
- s.close();
- System.out.println("PASSED: simple read/write test");
- }
- catch(IOException e)
- {
- System.out.println("FAILED: simple read/write test: " + e.getMessage());
- }
-
- /* Connect to our server socket */
- System.out.println("Test 6: Connect to ServerSocket");
- try
- {
- s = new Socket("localhost", 9999);
-
- PrintWriter out = new PrintWriter(new
- OutputStreamWriter(s.getOutputStream()));
-
- out.println("Hello, there server socket");
- out.print("I'm dun");
- out.flush();
- s.close();
- System.out.println("PASSED: connect to server socket");
- }
- catch(Exception e)
- {
- System.out.println("FAILED: connect to server socket: " + e);
- }
-
- System.out.println("Client stream socket test complete");
-}
-
-}
-