Java Code Examples for org.apache.http.client.fluent.Executor#use()
The following examples show how to use
org.apache.http.client.fluent.Executor#use() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedissonSessionManagerTest.java From redisson with Apache License 2.0 | 6 votes |
@Test public void testUpdateTwoServers() throws Exception { TomcatServer server1 = new TomcatServer("myapp", 8080, "src/test/"); server1.start(); Executor executor = Executor.newInstance(); BasicCookieStore cookieStore = new BasicCookieStore(); executor.use(cookieStore); write(executor, "test", "1234"); TomcatServer server2 = new TomcatServer("myapp", 8081, "src/test/"); server2.start(); read(8081, executor, "test", "1234"); read(executor, "test", "1234"); write(executor, "test", "324"); read(8081, executor, "test", "324"); Executor.closeIdleConnections(); server1.stop(); server2.stop(); }
Example 2
Source File: RedissonSessionManagerTest.java From redisson with Apache License 2.0 | 6 votes |
@Test public void testUpdateTwoServers() throws Exception { TomcatServer server1 = new TomcatServer("myapp", 8080, "src/test/"); server1.start(); Executor executor = Executor.newInstance(); BasicCookieStore cookieStore = new BasicCookieStore(); executor.use(cookieStore); write(executor, "test", "1234"); TomcatServer server2 = new TomcatServer("myapp", 8081, "src/test/"); server2.start(); read(8081, executor, "test", "1234"); read(executor, "test", "1234"); write(executor, "test", "324"); read(8081, executor, "test", "324"); Executor.closeIdleConnections(); server1.stop(); server2.stop(); }
Example 3
Source File: RedissonSessionManagerTest.java From redisson with Apache License 2.0 | 6 votes |
public void testExpiration() throws Exception { TomcatServer server1 = new TomcatServer("myapp", 8080, "src/test/"); server1.start(); Executor executor = Executor.newInstance(); BasicCookieStore cookieStore = new BasicCookieStore(); executor.use(cookieStore); write(executor, "test", "1234"); TomcatServer server2 = new TomcatServer("myapp", 8081, "src/test/"); server2.start(); Thread.sleep(30000); read(8081, executor, "test", "1234"); Thread.sleep(40000); executor.use(cookieStore); read(executor, "test", "1234"); Executor.closeIdleConnections(); server1.stop(); server2.stop(); }
Example 4
Source File: RedissonSessionManagerTest.java From redisson with Apache License 2.0 | 6 votes |
@Test public void testUpdateTwoServers() throws Exception { TomcatServer server1 = new TomcatServer("myapp", 8080, "src/test/"); server1.start(); Executor executor = Executor.newInstance(); BasicCookieStore cookieStore = new BasicCookieStore(); executor.use(cookieStore); write(executor, "test", "1234"); TomcatServer server2 = new TomcatServer("myapp", 8081, "src/test/"); server2.start(); read(8081, executor, "test", "1234"); read(executor, "test", "1234"); write(executor, "test", "324"); read(8081, executor, "test", "324"); Executor.closeIdleConnections(); server1.stop(); server2.stop(); }
Example 5
Source File: RedissonSessionManagerTest.java From redisson with Apache License 2.0 | 5 votes |
@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(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(); }
Example 6
Source File: RedissonSessionManagerTest.java From redisson with Apache License 2.0 | 5 votes |
@Test public void testExpiration() throws Exception { TomcatServer server1 = new TomcatServer("myapp", 8080, "src/test/"); server1.start(); Executor executor = Executor.newInstance(); BasicCookieStore cookieStore = new BasicCookieStore(); executor.use(cookieStore); write(executor, "test", "1234"); TomcatServer server2 = new TomcatServer("myapp", 8081, "src/test/"); server2.start(); Thread.sleep(30000); read(8081, executor, "test", "1234"); Thread.sleep(40000); executor.use(cookieStore); read(executor, "test", "1234"); Executor.closeIdleConnections(); server1.stop(); server2.stop(); }
Example 7
Source File: RedissonSessionManagerTest.java From redisson with Apache License 2.0 | 5 votes |
@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(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(); }
Example 8
Source File: RedissonSessionManagerTest.java From redisson with Apache License 2.0 | 5 votes |
@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(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(); }
Example 9
Source File: RedissonSessionManagerTest.java From redisson with Apache License 2.0 | 5 votes |
@Test public void testExpiration() throws Exception { TomcatServer server1 = new TomcatServer("myapp", 8080, "src/test/"); server1.start(); Executor executor = Executor.newInstance(); BasicCookieStore cookieStore = new BasicCookieStore(); executor.use(cookieStore); write(executor, "test", "1234"); TomcatServer server2 = new TomcatServer("myapp", 8081, "src/test/"); server2.start(); Thread.sleep(30000); read(8081, executor, "test", "1234"); Thread.sleep(40000); executor.use(cookieStore); read(executor, "test", "1234"); Executor.closeIdleConnections(); server1.stop(); server2.stop(); }