First beta of Clear SSL Sessions plugin for loadtest
Showing
1 changed file
with
37 additions
and
0 deletions
| ... | @@ -21,6 +21,43 @@ using System.Net; | ... | @@ -21,6 +21,43 @@ using System.Net; |
| 21 | 21 | ||
| 22 | namespace LIL_VSTT_Plugins | 22 | namespace LIL_VSTT_Plugins |
| 23 | { | 23 | { |
| 24 | /// <summary> | ||
| 25 | /// LoadTest Context Copy | ||
| 26 | /// </summary> | ||
| 27 | [DisplayName("Clear SSL Sessions")] | ||
| 28 | [Description("(C) Copyright 2018 LIGHTS IN LINE AB\r\nClears all SSL Sessions after each test from the SSLClients. Beta.")] | ||
| 29 | public class ClearSSLSessions : ILoadTestPlugin | ||
| 30 | { | ||
| 31 | LoadTest mLoadTest; | ||
| 32 | public void Initialize(LoadTest loadTest) | ||
| 33 | { | ||
| 34 | mLoadTest = loadTest; | ||
| 35 | mLoadTest.TestStarting += new EventHandler<TestStartingEventArgs>(mLoadTest_TestStarting); | ||
| 36 | mLoadTest.TestFinished += new EventHandler<TestFinishedEventArgs>(mLoadTest_TestFinished); | ||
| 37 | mLoadTest.TestSelected += new EventHandler<TestSelectedEventArgs>(mLoadTest_TestSelected); | ||
| 38 | } | ||
| 39 | void mLoadTest_TestStarting(object sender, TestStartingEventArgs e) | ||
| 40 | { | ||
| 41 | clearIt(); | ||
| 42 | } | ||
| 43 | void mLoadTest_TestFinished(object sender, TestFinishedEventArgs e) | ||
| 44 | { | ||
| 45 | clearIt(); | ||
| 46 | } | ||
| 47 | void mLoadTest_TestSelected(object sender, TestSelectedEventArgs e) | ||
| 48 | { | ||
| 49 | clearIt(); | ||
| 50 | } | ||
| 51 | |||
| 52 | void clearIt() | ||
| 53 | { | ||
| 54 | System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(typeof(System.Net.Security.SslStream)); | ||
| 55 | Type t = asm.GetType("System.Net.Security.SslSessionsCache"); | ||
| 56 | System.Reflection.FieldInfo f = t.GetField("s_CachedCreds", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); | ||
| 57 | System.Collections.Hashtable h = (System.Collections.Hashtable)f.GetValue(null); | ||
| 58 | h.Clear(); | ||
| 59 | } | ||
| 60 | } | ||
| 24 | 61 | ||
| 25 | /// <summary> | 62 | /// <summary> |
| 26 | /// LoadTest Context Copy | 63 | /// LoadTest Context Copy | ... | ... |
-
Please register or sign in to post a comment