public Session(Connection clientConnection, BufferAllocator bufferAllocator) { _clientConnection = clientConnection; _bufferAllocator = bufferAllocator; _request = new Request(this); _response = new Response(this); _clientHandler = new ClientHandler(this, _clientConnection); _serverHandler = new ServerHandler(this); }
internal Session(Pipe clientPipe, Pipe serverPipe, HttpProxy proxy) { Id = Guid.NewGuid(); ClientPipe = clientPipe; ClientHandler = new ClientHandler(this); ServerPipe = serverPipe; ServerHandler = new ServerHandler(this); Flags = new SessionFlag(); CurrentState = State.ReceivingHeaders; Proxy = proxy; }
internal async Task <Pipe> EnsureConnectedToServerAsync(Uri uri) { if (ServerPipe == null) { var socket = await ConnectToHostAsync(uri).WithoutCapturingContext(); ServerPipe = new Pipe(new NetworkStream(socket)); ServerHandler = new ServerHandler(this); } return(ServerPipe); }
public async Task <Socket> ConnectToHostAsync(Uri uri) { return(await ServerHandler.ConnectToHostAsync(uri).WithoutCapturingContext()); }