Commit 1eac38b7 1eac38b7b0c95f7362068eb19bfb348934771bea by Christian Gerdes

First beta of Clear SSL Sessions plugin for loadtest

1 parent 96bbe62e
......@@ -21,6 +21,43 @@ using System.Net;
namespace LIL_VSTT_Plugins
{
/// <summary>
/// LoadTest Context Copy
/// </summary>
[DisplayName("Clear SSL Sessions")]
[Description("(C) Copyright 2018 LIGHTS IN LINE AB\r\nClears all SSL Sessions after each test from the SSLClients. Beta.")]
public class ClearSSLSessions : ILoadTestPlugin
{
LoadTest mLoadTest;
public void Initialize(LoadTest loadTest)
{
mLoadTest = loadTest;
mLoadTest.TestStarting += new EventHandler<TestStartingEventArgs>(mLoadTest_TestStarting);
mLoadTest.TestFinished += new EventHandler<TestFinishedEventArgs>(mLoadTest_TestFinished);
mLoadTest.TestSelected += new EventHandler<TestSelectedEventArgs>(mLoadTest_TestSelected);
}
void mLoadTest_TestStarting(object sender, TestStartingEventArgs e)
{
clearIt();
}
void mLoadTest_TestFinished(object sender, TestFinishedEventArgs e)
{
clearIt();
}
void mLoadTest_TestSelected(object sender, TestSelectedEventArgs e)
{
clearIt();
}
void clearIt()
{
System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(typeof(System.Net.Security.SslStream));
Type t = asm.GetType("System.Net.Security.SslSessionsCache");
System.Reflection.FieldInfo f = t.GetField("s_CachedCreds", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
System.Collections.Hashtable h = (System.Collections.Hashtable)f.GetValue(null);
h.Clear();
}
}
/// <summary>
/// LoadTest Context Copy
......