Esempio n. 1
0
        internal NegotiationHandler CreateNegotiationHandler(NegotiationState state)
        {
                        #if INSTRUMENTATION
            if (Instrument != null)
            {
                var handler = Instrument.CreateNegotiationHandler(this, state);
                if (handler != null)
                {
                    return(handler);
                }
            }
                        #endif

            switch (state)
            {
            case NegotiationState.InitialClientConnection:
                return(new ClientConnection(this, false));

            case NegotiationState.RenegotiatingClientConnection:
                return(new ClientConnection(this, true));

            case NegotiationState.ClientKeyExchange:
                return(new ClientKeyExchange(this));

            case NegotiationState.InitialServerConnection:
                return(new ServerConnection(this, false));

            case NegotiationState.RenegotiatingServerConnection:
                return(new ServerConnection(this, true));

            case NegotiationState.ServerHello:
                return(new ServerHello(this));

            case NegotiationState.ServerFinished:
                return(new ServerFinished(this));

            default:
                throw new InvalidOperationException();
            }
        }