123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Net;
- using System.Net.Sockets;
- using System.Text;
- using HttpServer;
- using OpenSim.Framework;
- namespace OpenSim.Tests.Common
- {
- public class TestHttpClientContext: IHttpClientContext
- {
-
-
-
- public string ResponseBody
- {
- get { return Encoding.UTF8.GetString(m_responseStream.ToArray()); }
- }
- public Byte[] ResponseBodyBytes
- {
- get{ return m_responseStream.ToArray(); }
- }
- private MemoryStream m_responseStream = new MemoryStream();
- public bool IsSecured { get; set; }
- public bool Secured
- {
- get { return IsSecured; }
- set { IsSecured = value; }
- }
- public TestHttpClientContext(bool secured)
- {
- Secured = secured;
- }
- public void Disconnect(SocketError error)
- {
- }
- public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body) {Console.WriteLine("x");}
- public void Respond(string httpVersion, HttpStatusCode statusCode, string reason) {Console.WriteLine("xx");}
- public void Respond(string body) { Console.WriteLine("xxx");}
- public void Send(byte[] buffer)
- {
-
- }
- public void Send(byte[] buffer, int offset, int size)
- {
- m_responseStream.Write(buffer, offset, size);
- }
- public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body, string contentType) {Console.WriteLine("xxxxxx");}
- public void Close() { }
- public bool EndWhenDone { get { return false;} set { return;}}
- public HTTPNetworkContext GiveMeTheNetworkStreamIKnowWhatImDoing()
- {
- return new HTTPNetworkContext();
- }
- public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { };
-
-
-
- public event EventHandler<RequestEventArgs> RequestReceived = delegate { };
- }
- }
|