static void Test()
{
// Connect as client to port 1300
string server = "127.0.0.1";
TcpClient client = new TcpClient(server, 1300);
// Create a secure stream
using (SslStream sslStream = new SslStream(client.GetStream(), false,
new RemoteCertificateValidationCallback(ValidateServerCertificate), null))
{
sslStream.AuthenticateAsClient(server);
// ... Send and read data over the stream
byte[] buffer = new byte[1024];
int n = sslStream.Read(buffer, 0, 1024);
string _message = System.Text.Encoding.UTF8.GetString(buffer, 0, n);
System.Console.WriteLine("Client said: " + _message);
}
// Disconnect and close the client
client.Close();
}