void OnConnectionOpenComplete(IAsyncResult result) { AmqpConnection connection = (AmqpConnection)result.AsyncState; try { connection.EndOpen(result); connection.AmqpSettings.RuntimeProvider = this; connection.Closed += this.connection_Closed; lock (this.connections) { this.connections.Add(connection.Identifier, connection); } } catch (Exception exception) { connection.SafeClose(exception); } }