// Test disconnect. This will be fatal for most channels, but reliable
// channels
// should be able to recover from it. In any case transportConnected
// should be false
// immediately after the disconnect
final Slot disconnectEvent = new Slot();
sender.addTransportStatusEventListener(new TransportStatusEventListener() {
public void statusChanged(TransportStatusEvent e) {
if( e.getChannelStatus() == TransportStatusEvent.DISCONNECTED ) {
try {
disconnectEvent.offer(e, 1000);
} catch (InterruptedException e1) {
}
}
}
});
sender.forceDisconnect();
assertNotNull("Should have received state change notification", disconnectEvent.poll(1000*30));
assertFalse("Should be disconnected", sender.isTransportConnected());
//there could ber exceptions thrown - which are valid for a force disconnect
//so clear them so tearDown() will pass
exceptions.clear();
}