public HttpSession(HttpServer Server, IPEndPoint RemoteEndPoint, Func <ISessionContext, KeyValuePair <IServerImplementation, IHttpVirtualTransportServer> > VirtualTransportServerFactory, Action <Action> QueueUserWorkItem) { this.Server = Server; this.RemoteEndPoint = RemoteEndPoint; this.LastActiveTimeValue = new LockedVariable <DateTime>(DateTime.UtcNow); ssm = new SessionStateMachine <HttpVirtualTransportServerHandleResult, Unit>(ex => false, OnCriticalError, OnShutdownRead, OnShutdownWrite, OnWrite, OnExecute, OnStartRawRead, OnExit, QueueUserWorkItem); Context = Server.ServerContext.CreateSessionContext(); Context.Quit += ssm.NotifyExit; Context.Authenticated += () => Server.NotifySessionAuthenticated(this); Context.SecureConnectionRequired += c => { throw new NotImplementedException(); }; var Pair = VirtualTransportServerFactory(Context); si = Pair.Key; vts = Pair.Value; }