The StorageBackendException is catched two times so that the user see the "500 internal server error" only at the second catch (probably fixes #5).
2 * StarOffice News Server
3 * see AUTHORS for the list of contributors
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 import java.io.BufferedReader;
23 import java.io.IOException;
24 import java.io.InputStreamReader;
25 import java.io.PrintWriter;
26 import java.net.Socket;
27 import java.net.UnknownHostException;
30 * Base class for every test performed by the TestBench.
31 * Connects to a NNTP Server and provides basic methods for sending and
33 * @author Christian Lins
36 public abstract class AbstractTest
39 protected static PrintWriter log;
45 log = new PrintWriter(new File("test.log"));
53 protected BufferedReader in;
54 protected PrintWriter out;
55 protected Socket socket;
58 * Connects to NNTP Server using for
61 * @throws java.io.IOException
62 * @throws java.net.UnknownHostException
64 public void connect(String host, int port)
65 throws IOException, UnknownHostException
67 socket = new Socket(host, port);
68 socket.setSoTimeout(10000);
69 this.in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
70 this.out = new PrintWriter(socket.getOutputStream());
73 protected void println(String line)
75 this.out.println(line);
78 log.println(">> " + line);
82 protected String readln()
85 String line = this.in.readLine();
86 log.println("<< " + line);
91 public abstract int runTest() throws Exception;