log.error("Error receiving data");
System.err.println("Error receiving data");
    public void testStress() throws Exception {        String props=getTUNNELProps(startRouter());        channel=new JChannel(props);        channel.connect("agroup");        // receiver thread        new Thread(new Runnable() {            public void run() {                try {                    while(true) {                        if(channel == null)                            return;                        Object o=channel.receive(10000);                        if(o instanceof Message) {                            receivedCnt++;                            if(receivedCnt % 5000 == 0)                                System.out.println("-- received " + receivedCnt);                            if(receivedCnt == msgCount) {                                // let the main thread know I got all msgs                                promise.setResult(new Object());                                return;                            }                        }                    }                }                catch(TimeoutException e) {                    log.error("Timeout receiving from the channel. " + receivedCnt +                            " msgs received so far.");                }                catch(Exception e) {                    log.error("Error receiving data");                    e.printStackTrace();                }            }        }).start();        // stress send messages - the sender thread        new Thread(new Runnable() {            public void run() {                try {                    for(int i=0; i < msgCount; i++) {                        channel.send(null, null, new byte[payloadSize]);                        if(i % 5000 == 0)                            System.out.println("-- sent " + i);                    }                }                catch(Exception e) {                    log.error("Error sending data over ...");                    e.printStackTrace();                }            }        }).start();        // wait for all the messages to come; if I don't see all of them in        // mainTimeout ms, I fail the test        Object result=promise.getResult(mainTimeout);        if(result == null) {            String msg=                    "The channel has failed to send/receive " + msgCount + " messages " +                    "possibly because of the channel deadlock or too short " +                    "timeout (currently " + mainTimeout + " ms). " + receivedCnt +                    " messages received so far.";            fail(msg);        }        // don't close it in tearDown() because it hangs forever for a failed        // test.        channel.close();    }