TestResult result = new TestResult();
test.run(result);
Socket s = new Socket(InetAddress.getLocalHost(), port);
OutputStream os = s.getOutputStream();
if (result.failureCount() != 0) {
Enumeration e = result.failures();
Throwable t = ((TestFailure)e.nextElement()).thrownException();
t.printStackTrace(new PrintStream(os));
}
else if (result.errorCount() != 0) {
Enumeration e = result.errors();