private static bool PumpData(TlsProtocol from, TlsProtocol to, bool fragment)
        {
            int byteCount = from.GetAvailableOutputBytes();

            if (byteCount == 0)
            {
                return(false);
            }

            if (fragment)
            {
                byte[] buffer = new byte[1];
                while (from.GetAvailableOutputBytes() > 0)
                {
                    from.ReadOutput(buffer, 0, 1);
                    to.OfferInput(buffer);
                }
            }
            else
            {
                byte[] buffer = new byte[byteCount];
                from.ReadOutput(buffer, 0, buffer.Length);
                to.OfferInput(buffer);
            }

            return(true);
        }
        private static bool PumpData(TlsProtocol from, TlsProtocol to, bool fragment)
        {
            int byteCount = from.GetAvailableOutputBytes();
            if (byteCount == 0)
            {
                return false;
            }

            if (fragment)
            {
                while (from.GetAvailableOutputBytes() > 0)
                {
                    byte[] buffer = new byte[1];
                    from.ReadOutput(buffer, 0, 1);
                    to.OfferInput(buffer);
                }
            }
            else
            {
                byte[] buffer = new byte[byteCount];
                from.ReadOutput(buffer, 0, buffer.Length);
                to.OfferInput(buffer);
            }

            return true;
        }
        private static void CheckClosed(TlsProtocol protocol)
        {
            Assert.IsTrue(protocol.IsClosed);

            try
            {
                protocol.OfferInput(new byte[10]);
                Assert.Fail("Input was accepted after close");
            }
            catch (IOException)
            {
            }

            try
            {
                protocol.OfferOutput(new byte[10], 0, 10);
                Assert.Fail("Output was accepted after close");
            }
            catch (IOException)
            {
            }
        }
        private static void CheckClosed(TlsProtocol protocol)
        {
            Assert.IsTrue(protocol.IsClosed);

            try
            {
                protocol.OfferInput(new byte[10]);
                Assert.Fail("Input was accepted after close");
            }
            catch (IOException)
            {
            }

            try
            {
                protocol.OfferOutput(new byte[10], 0, 10);
                Assert.Fail("Output was accepted after close");
            }
            catch (IOException)
            {
            }
        }