public void go(PrintStream out) {
        KieServices ks = KieServices.Factory.get();
        KieContainer kContainer = ks.getKieClasspathContainer();

        KieSession kSession = kContainer.newKieSession("ksession1");
        kSession.setGlobal("out", out);
        kSession.insert(new Message("Dave", "Hello, HAL. Do you read me, HAL?"));
        kSession.fireAllRules();
    }
@Test
    public void testGo() {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos);
        new NamedKieSessionExample().go(ps);
        ps.close();

        String actual = baos.toString();
        String expected = "" +
                "Dave: Hello, HAL. Do you read me, HAL?" + NL +
                "HAL: Dave. I read you." + NL;
        assertEquals(expected, actual);
    }