summary refs log tree commit diff
path: root/crypto/PskTls13ClientTest.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@gmail.com>2022-06-21 21:20:55 +0700
committerPeter Dettman <peter.dettman@gmail.com>2022-06-21 21:20:55 +0700
commit3caee72adb537f7b784bb20a151abdaf858bffe0 (patch)
tree14c248b43d705683c4a560224a38a279795a0618 /crypto/PskTls13ClientTest.cs
parentRemove per-ECPoint compression (diff)
downloadBouncyCastle.NET-ed25519-3caee72adb537f7b784bb20a151abdaf858bffe0.tar.xz
Remove junk files
Diffstat (limited to 'crypto/PskTls13ClientTest.cs')
-rw-r--r--crypto/PskTls13ClientTest.cs85
1 files changed, 0 insertions, 85 deletions
diff --git a/crypto/PskTls13ClientTest.cs b/crypto/PskTls13ClientTest.cs
deleted file mode 100644

index 6f67b0572..000000000 --- a/crypto/PskTls13ClientTest.cs +++ /dev/null
@@ -1,85 +0,0 @@ -using System; -using System.IO; -using System.Net.Sockets; -using System.Text; - -using NUnit.Framework; - -using Org.BouncyCastle.Utilities.Date; - -namespace Org.BouncyCastle.Tls.Tests -{ - [TestFixture] - public class PskTls13ClientTest - { - [Test, Ignore] - public void TestConnection() - { - string host = "localhost"; - int port = 5556; - - long time0 = DateTimeUtilities.CurrentUnixMs(); - - MockPskTls13Client client = new MockPskTls13Client(); - TlsClientProtocol protocol = OpenTlsClientConnection(host, port, client); - - long time1 = DateTimeUtilities.CurrentUnixMs(); - Console.WriteLine("Elapsed: " + (time1 - time0) + "ms"); - - Http11Get(host, port, protocol.Stream); - - protocol.Close(); - } - - private static void Http11Get(string host, int port, Stream s) - { - WriteUtf8Line(s, "GET / HTTP/1.1"); - //WriteUtf8Line(s, "Host: " + host + ":" + port); - WriteUtf8Line(s, ""); - s.Flush(); - - Console.WriteLine("---"); - - string[] ends = new string[] { "</HTML>", "HTTP/1.1 3", "HTTP/1.1 4" }; - - StreamReader reader = new StreamReader(s); - - bool finished = false; - string line; - while (!finished && (line = reader.ReadLine()) != null) - { - Console.WriteLine("<<< " + line); - - string upperLine = TlsTestUtilities.ToUpperInvariant(line); - - // TEST CODE ONLY. This is not a robust way of parsing the result! - foreach (string end in ends) - { - if (upperLine.IndexOf(end) >= 0) - { - finished = true; - break; - } - } - } - - Console.Out.Flush(); - } - - private static TlsClientProtocol OpenTlsClientConnection(string hostname, int port, TlsClient client) - { - TcpClient tcp = new TcpClient(hostname, port); - - TlsClientProtocol protocol = new TlsClientProtocol(tcp.GetStream()); - protocol.Connect(client); - return protocol; - } - - private static void WriteUtf8Line(Stream output, string line) - { - byte[] buf = Encoding.UTF8.GetBytes(line + "\r\n"); - output.Write(buf, 0, buf.Length); - Console.WriteLine(">>> " + line); - } - } -}