tests/libjava-mauve/src/gnu/testlet/java/net/Socket/jdk12.java
branchjk_new_structure
changeset 1541 75c2e24dea9a
parent 1540 92ac284961c1
child 1542 be11db817bcf
equal deleted inserted replaced
1540:92ac284961c1 1541:75c2e24dea9a
     1 // Tags: JDK1.2
       
     2 // Uses: ServerThread
       
     3 
       
     4 /*
       
     5   Copyright (C) 2003 C. Brian Jones
       
     6   Copyright (C) 2005 Mark J. Wielaard
       
     7   
       
     8   This file is part of Mauve.
       
     9   
       
    10   Mauve is free software; you can redistribute it and/or modify
       
    11   it under the terms of the GNU General Public License as published by
       
    12   the Free Software Foundation; either version 2, or (at your option)
       
    13   any later version.
       
    14   
       
    15   Mauve is distributed in the hope that it will be useful,
       
    16   but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    18   GNU General Public License for more details.
       
    19   
       
    20   You should have received a copy of the GNU General Public License
       
    21   along with Mauve; see the file COPYING.  If not, write to
       
    22   the Free Software Foundation, 59 Temple Place - Suite 330,
       
    23   Boston, MA 02111-1307, USA.
       
    24 */
       
    25 
       
    26 package gnu.testlet.java.net.Socket;
       
    27 
       
    28 import java.io.IOException;
       
    29 import java.net.*;
       
    30 
       
    31 import gnu.testlet.Testlet;
       
    32 import gnu.testlet.TestHarness;
       
    33 
       
    34 public class jdk12 implements Testlet
       
    35 {
       
    36   public void test (TestHarness harness)
       
    37   {
       
    38     String host = "localhost";
       
    39     int port = 14610;
       
    40     Socket sock = null;
       
    41     ServerThread server = new ServerThread(harness, port);
       
    42     try 
       
    43       {
       
    44 	sock = new Socket (host, port);
       
    45 
       
    46 	harness.checkPoint("setSendBufferSize()");
       
    47 	harness.checkPoint("getSendBufferSize()");
       
    48 	harness.checkPoint("setReceiveBufferSize()");
       
    49 	harness.checkPoint("getReceiveBufferSize()");
       
    50 
       
    51       }
       
    52     catch (Throwable t)
       
    53       { 
       
    54 	harness.debug (t);
       
    55 	harness.fail ("unexpected error: " + t.getMessage ());
       
    56       }
       
    57     finally {
       
    58       try {
       
    59 	if (sock != null)
       
    60 	  sock.close();
       
    61 	server.close();
       
    62       } catch(IOException ignored) {}
       
    63     }
       
    64   }
       
    65 }