예제 #1
0
 private Microsoft.ServiceBus.Channels.IConnection SendPreamble(Microsoft.ServiceBus.Channels.IConnection connection, ArraySegment <byte> preamble, ref Microsoft.ServiceBus.Common.TimeoutHelper timeoutHelper)
 {
     this.decoder = new Microsoft.ServiceBus.Channels.ClientDuplexDecoder((long)0);
     byte[] numArray = new byte[1];
     connection.Write(preamble.Array, preamble.Offset, preamble.Count, true, timeoutHelper.RemainingTime());
     if (this.upgrade != null)
     {
         StreamUpgradeInitiator streamUpgradeInitiator = this.upgrade.CreateUpgradeInitiator(this.RemoteAddress, this.Via);
         Type     type     = streamUpgradeInitiator.GetType();
         object[] objArray = new object[] { timeoutHelper.RemainingTime() };
         InvokeHelper.InvokeInstanceMethod(type, streamUpgradeInitiator, "Open", objArray);
         if (!Microsoft.ServiceBus.Channels.ConnectionUpgradeHelper.InitiateUpgrade(streamUpgradeInitiator, ref connection, this.decoder, this, ref timeoutHelper))
         {
             Microsoft.ServiceBus.Channels.ConnectionUpgradeHelper.DecodeFramingFault(this.decoder, connection, this.Via, base.MessageEncoder.ContentType, ref timeoutHelper);
         }
         this.SetRemoteSecurity(streamUpgradeInitiator);
         Type     type1     = streamUpgradeInitiator.GetType();
         object[] objArray1 = new object[] { timeoutHelper.RemainingTime() };
         InvokeHelper.InvokeInstanceMethod(type1, streamUpgradeInitiator, "Close", objArray1);
         connection.Write(Microsoft.ServiceBus.Channels.SessionEncoder.PreambleEndBytes, 0, (int)Microsoft.ServiceBus.Channels.SessionEncoder.PreambleEndBytes.Length, true, timeoutHelper.RemainingTime());
     }
     if (!Microsoft.ServiceBus.Channels.ConnectionUpgradeHelper.ValidatePreambleResponse(numArray, connection.Read(numArray, 0, (int)numArray.Length, timeoutHelper.RemainingTime()), this.decoder, this.Via))
     {
         Microsoft.ServiceBus.Channels.ConnectionUpgradeHelper.DecodeFramingFault(this.decoder, connection, this.Via, base.MessageEncoder.ContentType, ref timeoutHelper);
     }
     return(connection);
 }
예제 #2
0
 public ClientDuplexConnectionReader(Microsoft.ServiceBus.Channels.ClientFramingDuplexSessionChannel channel, Microsoft.ServiceBus.Channels.IConnection connection, Microsoft.ServiceBus.Channels.ClientDuplexDecoder decoder, Microsoft.ServiceBus.Channels.IConnectionOrientedTransportFactorySettings settings, MessageEncoder messageEncoder) : base(connection, null, 0, 0, null)
 {
     this.decoder        = decoder;
     this.maxBufferSize  = settings.MaxBufferSize;
     this.bufferManager  = settings.BufferManager;
     this.messageEncoder = messageEncoder;
     this.channel        = channel;
 }