Opc.Ua.ServerTest.ServerTestClient.GetDefaultSession C# (CSharp) Method

GetDefaultSession() private method

Returns the a session to re-use for different tests.
private GetDefaultSession ( ) : Session
return Opc.Ua.Client.Session
        private Session GetDefaultSession()
        {
            if (m_session == null)
            {
                DateTime start = DateTime.UtcNow;                    
                m_session = CreateSession(m_configuration, m_bindingFactory, m_defaultEndpoint, null);
                
                if ((DateTime.UtcNow - start).TotalSeconds > 10)
                {
                    Report("WARNING: Unexpected delay creating a Session (maybe do to WCF DNS lookup problem). Delay={0}s", (DateTime.UtcNow - start).TotalSeconds);
                
                }

                // fetch the reference type tree.
                m_session.FetchTypeTree(ReferenceTypeIds.References);
                Report("Fetched the known ReferenceTypes from the Server");

                // fetch the data type tree.
                m_session.FetchTypeTree(DataTypeIds.BaseDataType);
                Report("Fetched the known DataTypes from the Server");
            }

            return m_session;
        }