2010-01-20 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mcs / class / System.Runtime.Remoting / Test / HttpCalls.cs
1 //
2 // MonoTests.Remoting.HttpCalls.cs
3 //
4 // Author: Lluis Sanchez Gual (lluis@ximian.com)
5 //
6 // 2003 (C) Copyright, Ximian, Inc.
7 //
8
9 using System;
10 using System.Collections;
11 using System.Runtime.Remoting;
12 using System.Runtime.Remoting.Channels;
13 using System.Runtime.Remoting.Channels.Http;
14 using NUnit.Framework;
15
16 namespace MonoTests.Remoting
17 {
18         [TestFixture]
19         public class HttpSyncCallTest : SyncCallTest
20         {
21                 public override ChannelManager CreateChannelManager ()
22                 {
23                         return new HttpChannelManager ();
24                 }
25         }
26
27         [TestFixture]
28         public class HttpAsyncCallTest : AsyncCallTest
29         {
30                 public override ChannelManager CreateChannelManager ()
31                 {
32                         return new HttpChannelManager ();
33                 }
34         }
35
36         [TestFixture]
37         public class HttpReflectionCallTest : ReflectionCallTest
38         {
39                 public override ChannelManager CreateChannelManager ()
40                 {
41                         return new HttpChannelManager ();
42                 }
43         }
44
45         [TestFixture]
46         public class HttpDelegateCallTest : DelegateCallTest
47         {
48                 public override ChannelManager CreateChannelManager ()
49                 {
50                         return new HttpChannelManager ();
51                 }
52         }
53         
54         [TestFixture]
55         public class HttpBinarySyncCallTest : SyncCallTest
56         {
57                 public override ChannelManager CreateChannelManager ()
58                 {
59                         return new HttpChannelManager ();
60                 }
61         }
62
63         [Serializable]
64         public class HttpChannelManager : ChannelManager
65         {
66                 public override IChannelSender CreateClientChannel ()
67                 {
68                         Hashtable options = new Hashtable ();
69                         options ["timeout"] = 10000; // 10s
70                         return new HttpClientChannel (options, null);
71                 }
72
73                 public override IChannelReceiver CreateServerChannel ()
74                 {
75                         return new HttpChannel (0);
76                 }
77         }
78         
79         [Serializable]
80         public class HttpBinaryChannelManager : ChannelManager
81         {
82                 public override IChannelSender CreateClientChannel ()
83                 {
84                         Hashtable options = new Hashtable ();
85                         options ["timeout"] = 10000; // 10s
86                         options ["name"] = "binary http channel";
87                         return new HttpClientChannel (options,  new BinaryClientFormatterSinkProvider ());
88                 }
89
90                 public override IChannelReceiver CreateServerChannel ()
91                 {
92                         return new HttpChannel (0);
93                 }
94         }
95 }
96