Open() private method

private Open ( ) : void
return void
        public void TestSendQueryMessage()
        {
            //Connection conn = new Connection("10.141.153.2");
            Connection conn = new Connection();
            conn.Open();

            QueryMessage qmsg = generateQueryMessage();
            conn.SendTwoWayMessage(qmsg);

            conn.Close();
        }
Esempio n. 2
0
        public void TestSendQueryMessage()
        {
            //Connection conn = new Connection("10.141.153.2");
            Connection conn = new Connection();
            conn.Open();

            BsonDocument qdoc = new BsonDocument();
            qdoc.Add("listDatabases", new BsonNumber(1.0));
            //QueryMessage qmsg = new QueryMessage(qdoc,"system.namespaces");
            QueryMessage qmsg = new QueryMessage(qdoc,"admin.$cmd");
            qmsg.NumberToReturn = -1;
            conn.SendTwoWayMessage(qmsg);

            conn.Close();
        }
        public void TestReconnectOnce()
        {
            Connection conn = new Connection();
            conn.Open();

            WriteBadMessage(conn);
            try{
                QueryMessage qmsg = generateQueryMessage();
                conn.SendTwoWayMessage(qmsg);

            }catch(IOException){
                //Should be able to resend.
                Assert.IsTrue(conn.State == ConnectionState.Opened);
                QueryMessage qmsg = generateQueryMessage();
                ReplyMessage rmsg = conn.SendTwoWayMessage(qmsg);
                Assert.IsNotNull(rmsg);

            }
        }
Esempio n. 4
0
 public Boolean Connect()
 {
     connection.Open();
     return(connection.State == ConnectionState.Opened);
 }