@Before public void setUp() throws Exception { cl = ClassLoader.getSystemClassLoader(); ConsoleHandler handler = new ConsoleHandler(); handler.setLevel(Level.ALL); Logger.getLogger("").addHandler(handler); Logger.getLogger(JsonRpcBasicServer.class.getName()).setLevel(Level.ALL); Logger.getLogger(JsonRpcClient.class.getName()).setLevel(Level.ALL); jsonRpcServer = new JsonRpcBasicServer(serviceMock, Service.class); jsonRpcClient = new JsonRpcClient(); // create streams clientInputStream = new PipedInputStream(); serverOutputStream = new PipedOutputStream(clientInputStream); serverInputStream = new PipedInputStream(); clientOutputStream = new PipedOutputStream(serverInputStream); // start server serverThread = new ServerThread(serverInputStream, serverOutputStream, jsonRpcServer); serverThread.start(); serverThread.waitForStart(); }
@After public void tearDown() throws Exception { serverThread.stopServer(); }