/// <summary>
        /// Opens and returns (with out parameters) a pair of communicating sockets.
        /// </summary>
        private static void OpenSockets(int port, out StringSocketListener server, out StringSocket s1, out SS s2)
        {
            server = new StringSocketListener(port, new UTF8Encoding());
            server.Start();
            SSClient client = new SSClient("localhost", port, new UTF8Encoding());

            s1 = server.AcceptStringSocket();
            s2 = client.Client;
        }
 /// <summary>
 /// Closes stuff down
 /// </summary>
 private static void CloseSockets(StringSocketListener server, StringSocket s1, SS s2)
 {
     try
     {
         s1.Shutdown(SocketShutdown.Both);
     }
     finally
     {
     }
     try
     {
         s2.Shutdown(SocketShutdown.Both);
     }
     finally
     {
     }
     try
     {
         s1.Close();
     }
     finally
     {
     }
     try
     {
         s2.Close();
     }
     finally
     {
     }
     try
     {
         server.Stop();
     }
     finally
     {
     }
 }