public void TestWriteMessageFail()
{
this.transport.FailOnKeepAliveInfoSends = true ;
this.transport.NumSentKeepAliveInfosBeforeFail = 4;
InactivityMonitor monitor = new InactivityMonitor( this.transport );
monitor.Exception += new ExceptionHandler(OnException);
monitor.Command += new CommandHandler(OnCommand);
monitor.Start();
// Send the local one for the monitor to record.
monitor.Oneway( this.localWireFormatInfo );
Thread.Sleep( 2000 );
ActiveMQMessage message = new ActiveMQMessage();
this.transport.InjectCommand( message );
Thread.Sleep( 2000 );
// Should not have timed out on Read yet.
Assert.IsTrue( this.exceptions.Count == 0 );
for(int ix = 0; ix < 4; ix++)
{
this.transport.InjectCommand( message );
Thread.Sleep( 2000 );
}
// Channel should have been inactive for to long.
Assert.IsTrue( this.exceptions.Count > 0 );
}