use of org.apache.http.client.fluent.Executor in project redisson by redisson.
the class RedissonSessionManagerTest method testUpdate.
@Test
public void testUpdate() throws Exception {
// start the server at http://localhost:8080/myapp
TomcatServer server = new TomcatServer("myapp", 8080, "src/test/");
server.start();
Executor executor = Executor.newInstance();
write(8080, executor, "test", "1");
read(8080, executor, "test", "1");
write(8080, executor, "test", "2");
read(8080, executor, "test", "2");
Executor.closeIdleConnections();
server.stop();
}
use of org.apache.http.client.fluent.Executor in project redisson by redisson.
the class RedissonSessionManagerTest method testHttpSessionListener.
@Test
public void testHttpSessionListener() throws Exception {
TomcatServer server1 = new TomcatServer("myapp", 8080, "src/test/");
server1.start();
TomcatServer server2 = new TomcatServer("myapp", 8081, "src/test/");
server2.start();
Executor executor = Executor.newInstance();
BasicCookieStore cookieStore = new BasicCookieStore();
executor.use(cookieStore);
TestHttpSessionListener.CREATED_INVOCATION_COUNTER = 0;
TestHttpSessionListener.DESTROYED_INVOCATION_COUNTER = 0;
write(8080, executor, "test", "1234");
TomcatServer server3 = new TomcatServer("myapp", 8082, "src/test/");
server3.start();
invalidate(executor);
Thread.sleep(500);
Assert.assertEquals(2, TestHttpSessionListener.CREATED_INVOCATION_COUNTER);
Assert.assertEquals(3, TestHttpSessionListener.DESTROYED_INVOCATION_COUNTER);
Executor.closeIdleConnections();
server1.stop();
server2.stop();
server3.stop();
}
use of org.apache.http.client.fluent.Executor in project redisson by redisson.
the class RedissonSessionManagerTest method testSwitchServer.
@Test
public void testSwitchServer() throws Exception {
// start the server at http://localhost:8080/myapp
TomcatServer server = new TomcatServer("myapp", 8080, "src/test/");
server.start();
Executor executor = Executor.newInstance();
BasicCookieStore cookieStore = new BasicCookieStore();
executor.use(cookieStore);
write(8080, executor, "test", "1234");
System.out.println("done1");
Cookie cookie = cookieStore.getCookies().get(0);
Executor.closeIdleConnections();
server.stop();
server = new TomcatServer("myapp", 8080, "src/test/");
server.start();
executor = Executor.newInstance();
cookieStore = new BasicCookieStore();
cookieStore.addCookie(cookie);
executor.use(cookieStore);
read(8080, executor, "test", "1234");
remove(executor, "test", "null");
Executor.closeIdleConnections();
server.stop();
}
use of org.apache.http.client.fluent.Executor in project redisson by redisson.
the class RedissonSessionManagerTest method testUpdate.
@Test
public void testUpdate() throws Exception {
// start the server at http://localhost:8080/myapp
TomcatServer server = new TomcatServer("myapp", 8080, "src/test/");
server.start();
Executor executor = Executor.newInstance();
write(executor, "test", "1");
read(executor, "test", "1");
write(executor, "test", "2");
read(executor, "test", "2");
Executor.closeIdleConnections();
server.stop();
}
use of org.apache.http.client.fluent.Executor in project redisson by redisson.
the class RedissonSessionManagerTest method testSwitchServer.
@Test
public void testSwitchServer() throws Exception {
// start the server at http://localhost:8080/myapp
TomcatServer server = new TomcatServer("myapp", 8080, "src/test/");
server.start();
Executor executor = Executor.newInstance();
BasicCookieStore cookieStore = new BasicCookieStore();
executor.use(cookieStore);
write(executor, "test", "1234");
Cookie cookie = cookieStore.getCookies().get(0);
Executor.closeIdleConnections();
server.stop();
server = new TomcatServer("myapp", 8080, "src/test/");
server.start();
executor = Executor.newInstance();
cookieStore = new BasicCookieStore();
cookieStore.addCookie(cookie);
executor.use(cookieStore);
read(executor, "test", "1234");
remove(executor, "test", "null");
Executor.closeIdleConnections();
server.stop();
}
Aggregations