* New ServerSocket AcceptTimeout test
@ 2006-05-14 19:54 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2006-05-14 19:54 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1.1: Type: text/plain, Size: 195 bytes --]
Hi,
Here is a test for a bug found in classpath.
2006-05-14 Mark Wielaard <mark@klomp.org>
* gnu/testlet/java/net/ServerSocket/AcceptTimeout.java: New test.
Committed,
Mark
[-- Attachment #1.2: AcceptTimeout.java --]
[-- Type: text/x-java, Size: 1894 bytes --]
/* AcceptGetLocalPort.java - Test timeout on accepted Socket.
Copyright (C) 2006, Mark J. Wielaard <mark@klomp.org>
This file is part of Mauve.
Mauve is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
Mauve is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mauve; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA. */
// Tags: JDK1.0
package gnu.testlet.java.net.ServerSocket;
import gnu.testlet.Testlet;
import gnu.testlet.TestHarness;
import java.net.*;
import java.io.*;
/** Checks that a Socket doesn't inherit the timeout of a ServerSocket. */
public class AcceptTimeout implements Testlet, Runnable
{
private static int port = 5678;
public void test (TestHarness harness)
{
new Thread(this).start();
try
{
ServerSocket ss = new ServerSocket(port);
ss.setSoTimeout(200);
Socket s = ss.accept();
harness.check(s.getSoTimeout(), 0);
s.close();
ss.close();
}
catch (IOException ioe)
{
harness.debug(ioe);
harness.check(false, ioe.toString());
}
}
public void run()
{
int i = 0;
while (i < 10)
{
try
{
Socket s = new Socket("localhost", port);
break;
}
catch (IOException ioe)
{
// ignore
}
try
{
Thread.sleep(1000);
}
catch (InterruptedException ie)
{
// ignore
}
}
}
}
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-05-14 19:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-14 19:54 New ServerSocket AcceptTimeout test Mark Wielaard
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).