public void run() {
try {
if(_xAcceptor != null) { // write what we read
_xConnection = _xAcceptor.accept(_connectionDcp);
XConnectionBroadcaster xConnectionBroadcaster = (XConnectionBroadcaster)UnoRuntime.queryInterface(XConnectionBroadcaster.class,
_xConnection);
xConnectionBroadcaster.addStreamListener(this);
byte block[] = readBlock();
while(block.length > 0 && !_withError) {
writeBlock(block);
_xConnection.flush();
block = readBlock();
}
_xAcceptor.stopAccepting();
}
else if(_xConnector != null) { // write random data and check
_xConnection = _xConnector.connect(_connectionDcp);
XConnectionBroadcaster xConnectionBroadcaster = (XConnectionBroadcaster)UnoRuntime.queryInterface(XConnectionBroadcaster.class,
_xConnection);
xConnectionBroadcaster.addStreamListener(this);
for(int i = 0; i < 10; ++ i) { // send 10 blocks
writeBlock(_defBlock);
_xConnection.flush();