I'm trying to write a jmeter sampler in beanshell to execute a memcached telnet interface command, specifically flush_all. I need this to clear the cache after each test as it causes tests in quick succession to fail.
I have the following code:
import org.apache.commons.net.telnet.TelnetClient;
TelnetClient telnet = new TelnetClient();
telnet.connect( "memcachedServer.dev", 11211 );
//InputStream in = telnet.getInputStream();
PrintStream out = new PrintStream( telnet.getOutputStream() );
out.println("flush_all\r");
out.println("quit\r");
telnet.disconnect();
It seems to execute with no problems but the cache is not cleared. I have tried the code with and without the "\r" but neither way works.
Anyone know what's wrong?
Thanks, Adrian