Connection object that connects to a replica pair.
Inheritance: Connection
 public void TestConnectingToNonPaired()
 {
     PairedConnection pc = new PairedConnection(Connection.DEFAULTHOST,Connection.DEFAULTPORT, Connection.DEFAULTHOST, DefaultSlavePort);
     pc.Open();
     Assert.AreEqual(ConnectionState.Opened, pc.State);
     Assert.IsFalse(pc.Paired);
 }
        public void TestConnectingToNonPaired()
        {
            PairedConnection pc = new PairedConnection(Connection.DEFAULTHOST, Connection.DEFAULTPORT, Connection.DEFAULTHOST, DefaultSlavePort);

            pc.Open();
            Assert.AreEqual(ConnectionState.Opened, pc.State);
            Assert.IsFalse(pc.Paired);
        }
 public void TestConnectingToSlaveOk()
 {
     PairedConnection pc = new PairedConnection(Connection.DEFAULTHOST,DefaultSlavePort, Connection.DEFAULTHOST, DefaultMasterPort,true);
     pc.Open();
     Assert.AreEqual(ConnectionState.Opened, pc.State);
     Assert.IsTrue(pc.Paired);
     Assert.IsFalse(pc.ConnectedToMaster);
 }
        public void TestConnectingToSlaveNotOk()
        {
            PairedConnection pc = new PairedConnection(Connection.DEFAULTHOST, DefaultSlavePort, Connection.DEFAULTHOST, DefaultMasterPort, false);

            pc.Open();
            Assert.AreEqual(ConnectionState.Opened, pc.State);
            Assert.IsTrue(pc.Paired);
            Assert.IsTrue(pc.ConnectedToMaster);
        }
 public void TestConnectingToDownMaster()
 {
     int badport = 33333;
     PairedConnection pc = new PairedConnection(Connection.DEFAULTHOST,badport, Connection.DEFAULTHOST, DefaultMasterPort,false);
     pc.Open();
     Assert.AreEqual(ConnectionState.Opened, pc.State);
     Assert.IsTrue(pc.Paired);
     Assert.IsTrue(pc.ConnectedToMaster);
 }
        public void TestConnectingToDownMaster()
        {
            int badport         = 33333;
            PairedConnection pc = new PairedConnection(Connection.DEFAULTHOST, badport, Connection.DEFAULTHOST, DefaultMasterPort, false);

            pc.Open();
            Assert.AreEqual(ConnectionState.Opened, pc.State);
            Assert.IsTrue(pc.Paired);
            Assert.IsTrue(pc.ConnectedToMaster);
        }
        public void TestConnectingToSlaveUsingBadMasterInfoThrowsException()
        {
            int badport             = 33333;
            PairedConnection pc     = new PairedConnection(Connection.DEFAULTHOST, DefaultSlavePort, Connection.DEFAULTHOST, badport, false);
            bool             thrown = false;

            try{
                pc.Open();
            }catch (SocketException) {
                thrown = true;
            }
            Assert.IsTrue(thrown, "SocketException should have been thrown");
        }
 public void TestConnectingToDownBothThrowsException()
 {
     /*
      * Be careful with this test.  The recursion is set in the open to fail out of the
      * SocketException catches.  If the PairedConnection.Open method is changed to
      * screw that up it will cause an infinite loop.
      */
     int badport = 33333;
     PairedConnection pc = new PairedConnection(Connection.DEFAULTHOST,badport, Connection.DEFAULTHOST, badport);
     bool thrown = false;
     try{
         pc.Open();
     }catch(SocketException){
         thrown = true;
     }
     Assert.IsTrue(thrown, "SocketException should have been thrown");
 }
        public void TestConnectingToDownBothThrowsException()
        {
            /*
             * Be careful with this test.  The recursion is set in the open to fail out of the
             * SocketException catches.  If the PairedConnection.Open method is changed to
             * screw that up it will cause an infinite loop.
             */
            int badport             = 33333;
            PairedConnection pc     = new PairedConnection(Connection.DEFAULTHOST, badport, Connection.DEFAULTHOST, badport);
            bool             thrown = false;

            try{
                pc.Open();
            }catch (SocketException) {
                thrown = true;
            }
            Assert.IsTrue(thrown, "SocketException should have been thrown");
        }
 public void TestConnectingToSlaveUsingBadMasterInfoThrowsException()
 {
     int badport = 33333;
     PairedConnection pc = new PairedConnection(Connection.DEFAULTHOST, DefaultSlavePort, Connection.DEFAULTHOST, badport, false);
     bool thrown = false;
     try{
         pc.Open();
     }catch(SocketException){
         thrown = true;
     }
     Assert.IsTrue(thrown, "SocketException should have been thrown");
 }