public override void TransitionToState(ISessionContext context) { context.CloseServerConnection(); if (context.RecentRequestHeader.IsSsl) { context.ChangeState(SessionStateType.Https); } else { string host; int port; if (SessionStateUtils.TryParseAddress(context.RecentRequestHeader, out host, out port)) { context.BeginConnectToRemoteHost(host, port); } else { ServiceLog.Logger.Error("{0} Unable to parse host address: {1}", context.Id, Encoding.UTF8.GetString(context.RecentRequestHeader.GetBuffer())); context.Reset(); } } }