public HttpResponse SendRequest(HttpRequest request) { if (Connection != null) { Connection.WriteMessage(request); return(Connection.ReadMessage() as HttpResponse); } else { var writer = new HttpWriter(RawStream); writer.WriteMessage(request); var parser = new HttpParser(RawStream); return(parser.ParseMessageAsync().Result as HttpResponse); } }
public static async Task <HttpMessage> ParseMessage(HttpConnectionStream connection) { var parser = new HttpParser(connection); return(await parser.ParseMessageAsync()); }