in src/Connection.cs [356:412]
void Connect(SaslProfile saslProfile, Open open)
{
if (open != null)
{
this.maxFrameSize = open.MaxFrameSize;
this.channelMax = open.ChannelMax;
}
else
{
open = new Open()
{
ContainerId = MakeAmqpContainerId(),
HostName = this.address.Host,
MaxFrameSize = this.maxFrameSize,
ChannelMax = this.channelMax
};
}
if (open.IdleTimeOut > 0)
{
this.heartBeat = new HeartBeat(this, open.IdleTimeOut * 2);
}
ITransport transport;
{
TcpTransport tcpTransport = new TcpTransport();
tcpTransport.Connect(this, this.address, DisableServerCertValidation);
transport = tcpTransport;
}
try
{
if (saslProfile != null)
{
transport = saslProfile.Open(this.address.Host, transport);
}
else if (this.address.User != null)
{
transport = new SaslPlainProfile(this.address.User, this.address.Password).Open(this.address.Host, transport);
}
}
catch
{
transport.Close();
throw;
}
this.writer = new Writer(transport);
// after getting the transport, move state to open pipe before starting the pump
this.SendHeader();
this.SendOpen(open);
this.state = ConnectionState.OpenPipe;
this.reader = new Pump(this, transport);
this.reader.Start();
}