diff --git a/WebSockets.sln b/WebSockets.sln
index 98f957f7e5..abcfa94b4f 100644
--- a/WebSockets.sln
+++ b/WebSockets.sln
@@ -7,6 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Net.WebSockets",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Net.WebSockets.Test", "test\Microsoft.Net.WebSockets.Test\Microsoft.Net.WebSockets.Test.csproj", "{EF1FE910-6E0C-4DE8-8CC1-6118B726A59E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient", "test\TestClient\TestClient.csproj", "{22AB02E0-0346-4C4B-BBE7-C829A8D1C19E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestServer", "test\TestServer\TestServer.csproj", "{4E5F5FCC-172C-44D9-BEA0-39098A79CD0B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +25,14 @@ Global
{EF1FE910-6E0C-4DE8-8CC1-6118B726A59E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF1FE910-6E0C-4DE8-8CC1-6118B726A59E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF1FE910-6E0C-4DE8-8CC1-6118B726A59E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {22AB02E0-0346-4C4B-BBE7-C829A8D1C19E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {22AB02E0-0346-4C4B-BBE7-C829A8D1C19E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {22AB02E0-0346-4C4B-BBE7-C829A8D1C19E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {22AB02E0-0346-4C4B-BBE7-C829A8D1C19E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4E5F5FCC-172C-44D9-BEA0-39098A79CD0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4E5F5FCC-172C-44D9-BEA0-39098A79CD0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4E5F5FCC-172C-44D9-BEA0-39098A79CD0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4E5F5FCC-172C-44D9-BEA0-39098A79CD0B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/test/TestClient/App.config b/test/TestClient/App.config
new file mode 100644
index 0000000000..8e15646352
--- /dev/null
+++ b/test/TestClient/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/TestClient/Program.cs b/test/TestClient/Program.cs
new file mode 100644
index 0000000000..2c16bc5576
--- /dev/null
+++ b/test/TestClient/Program.cs
@@ -0,0 +1,36 @@
+using Microsoft.Net.WebSockets.Client;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.WebSockets;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace TestClient
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Waiting to start");
+ Console.ReadKey();
+ RunTestAsync().Wait();
+ }
+
+ private static async Task RunTestAsync()
+ {
+ WebSocketClient client = new WebSocketClient();
+ WebSocket socket = await client.ConnectAsync(new Uri("ws://chrross-togo:12345/"), CancellationToken.None);
+ byte[] data = Encoding.UTF8.GetBytes("Hello World");
+ while (true)
+ {
+ await socket.SendAsync(new ArraySegment(data), WebSocketMessageType.Text, true, CancellationToken.None);
+ WebSocketReceiveResult result = await socket.ReceiveAsync(new ArraySegment(data), CancellationToken.None);
+ Console.WriteLine(result.MessageType + ", " + result.Count + ", " + result.EndOfMessage);
+ Console.WriteLine(Encoding.UTF8.GetString(data, 0, result.Count));
+ }
+ await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Closing", CancellationToken.None);
+ }
+ }
+}
diff --git a/test/TestClient/Properties/AssemblyInfo.cs b/test/TestClient/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..1ef2184108
--- /dev/null
+++ b/test/TestClient/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("TestClient")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("TestClient")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("0a30acb8-eb32-43ad-ab6c-36c070d6ba51")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/test/TestClient/TestClient.csproj b/test/TestClient/TestClient.csproj
new file mode 100644
index 0000000000..842f76c15d
--- /dev/null
+++ b/test/TestClient/TestClient.csproj
@@ -0,0 +1,64 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {22AB02E0-0346-4C4B-BBE7-C829A8D1C19E}
+ Exe
+ Properties
+ TestClient
+ TestClient
+ v4.5
+ 512
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {6c1d09ca-f799-44ae-8ec8-9d19c76080c1}
+ Microsoft.Net.WebSockets
+
+
+
+
+
\ No newline at end of file
diff --git a/test/TestServer/App.config b/test/TestServer/App.config
new file mode 100644
index 0000000000..8e15646352
--- /dev/null
+++ b/test/TestServer/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/TestServer/Program.cs b/test/TestServer/Program.cs
new file mode 100644
index 0000000000..59b5825b55
--- /dev/null
+++ b/test/TestServer/Program.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.WebSockets;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace TestServer
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ RunEchoServer().Wait();
+ }
+
+ private static async Task RunEchoServer()
+ {
+ HttpListener listener = new HttpListener();
+ listener.Prefixes.Add("http://*:12345/");
+ listener.Start();
+ Console.WriteLine("Started");
+
+ while (true)
+ {
+ HttpListenerContext context = listener.GetContext();
+ if (!context.Request.IsWebSocketRequest)
+ {
+ context.Response.Close();
+ continue;
+ }
+ Console.WriteLine("Accepted");
+
+ var wsContext = await context.AcceptWebSocketAsync(null);
+ var webSocket = wsContext.WebSocket;
+
+ byte[] buffer = new byte[1024];
+ WebSocketReceiveResult received = await webSocket.ReceiveAsync(new ArraySegment(buffer), CancellationToken.None);
+
+ while (received.MessageType != WebSocketMessageType.Close)
+ {
+ Console.WriteLine("Echo");
+ // Echo anything we receive
+ await webSocket.SendAsync(new ArraySegment(buffer, 0, received.Count), received.MessageType, received.EndOfMessage, CancellationToken.None);
+
+ received = await webSocket.ReceiveAsync(new ArraySegment(buffer), CancellationToken.None);
+ }
+
+ await webSocket.CloseAsync(received.CloseStatus.Value, received.CloseStatusDescription, CancellationToken.None);
+
+ webSocket.Dispose();
+ Console.WriteLine("Finished");
+ }
+ }
+ }
+}
diff --git a/test/TestServer/Properties/AssemblyInfo.cs b/test/TestServer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..1a5999f7d8
--- /dev/null
+++ b/test/TestServer/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("TestServer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("TestServer")]
+[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("ffe69337-e3b4-4625-8244-36bd609742ba")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/test/TestServer/TestServer.csproj b/test/TestServer/TestServer.csproj
new file mode 100644
index 0000000000..24d42de384
--- /dev/null
+++ b/test/TestServer/TestServer.csproj
@@ -0,0 +1,58 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {4E5F5FCC-172C-44D9-BEA0-39098A79CD0B}
+ Exe
+ Properties
+ TestServer
+ TestServer
+ v4.5
+ 512
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file