public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Steve Murry" <Steve.Murry@sas.com>
To: <mauve-discuss@sources.redhat.com>
Subject: Purpose of .net.SocketTest test_BasicServer #12
Date: Wed, 29 Jan 2003 21:10:00 -0000	[thread overview]
Message-ID: <F2E670D5036BE14E89473A3FAEDE6ACE01BD6B56@merc18.na.sas.com> (raw)

Can someone examine the following testcase in the .net.Socket package and let me know what it is designed to test.  I'm unsure about the garbage collector comment, but it would appear that the purpose of the test is to connect to the local Echo server at port #7, and then test the getInputStream() and getOutputStream() methods.  However, it then expects an IOException, and why I'm not sure.  On some of our unix hosts that I'm using, we *do* get an exception within the test, but the exception is on the 'new Socket("127.0.0.1", 7)' statement because the Echo server wasn't running at the time.  However, in this case the Mauve harness check still reported this test as 'PASS' because of the catch code.  My gut feeling is that the test is not designed to test the Echo server but rather to test the Input and Output methods; however, I'll leave it up to bigger minds to make the final determination.

Thanks for the help

Steve Murry
SAS Institute, Inc. 


    // This test is incorrect.  You cannot rely on System.gc() causing
    // the garbage collector to run.
    try {
      sock = new Socket("127.0.0.1", 7);
      InputStream sin = null;
      OutputStream sout = null;

      // create 10 refs and make sure finalize() is invoked.
      for (int i = 0; i < 10; i++) {
        sin = sock.getInputStream();
        sout = sock.getOutputStream();
      }
      harness.fail("Error : test_BasicServer failed - 12 " +
                   "exception was not thrown");
    }
    catch (IOException e) {
      harness.check(true);
    }
    finally {
      try {
        if (sock != null)
          sock.close();
      } catch(IOException ignored) {}
    }

    // invoke finalize()
    System.gc();

             reply	other threads:[~2003-01-29 21:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-29 21:10 Steve Murry [this message]
2003-01-30  4:38 ` Brian Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F2E670D5036BE14E89473A3FAEDE6ACE01BD6B56@merc18.na.sas.com \
    --to=steve.murry@sas.com \
    --cc=mauve-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).