Java Code Examples for org.apache.http.client.fluent.Executor#closeIdleConnections()

The following examples show how to use org.apache.http.client.fluent.Executor#closeIdleConnections() . 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 vote down vote up
@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();
}
 
Example 2
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 6 votes vote down vote up
@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 vote down vote up
@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 4
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example 5
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example 6
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example 7
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 6 votes vote down vote up
@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 8
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 6 votes vote down vote up
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 9
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@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 10
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Test
public void testWriteReadRemove() 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", "1234");
    read(executor, "test", "1234");
    remove(executor, "test", "null");
    
    Executor.closeIdleConnections();
    server.stop();
}
 
Example 11
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@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 12
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@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 13
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Test
public void testRecreate() 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");
    recreate(executor, "test", "2");
    read(executor, "test", "2");
    
    Executor.closeIdleConnections();
    server.stop();
}
 
Example 14
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Test
public void testRecreate() 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");
    recreate(executor, "test", "2");
    read(executor, "test", "2");
    
    Executor.closeIdleConnections();
    server.stop();
}
 
Example 15
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Test
public void testWriteReadRemove() 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", "1234");
    read(executor, "test", "1234");
    remove(executor, "test", "null");
    
    Executor.closeIdleConnections();
    server.stop();
}
 
Example 16
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@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 17
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@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 18
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Test
public void testRecreate() 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");
    recreate(executor, "test", "2");
    read(executor, "test", "2");
    
    Executor.closeIdleConnections();
    server.stop();
}
 
Example 19
Source File: RedissonSessionManagerTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Test
public void testWriteReadRemove() 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", "1234");
    read(executor, "test", "1234");
    remove(executor, "test", "null");
    
    Executor.closeIdleConnections();
    server.stop();
}
 
Example 20
Source File: DirectDebitPaymentIT.java    From pay-publicapi with MIT License 4 votes vote down vote up
@After
public void teardown() {
    Executor.closeIdleConnections();
}