Example usage for org.apache.http.impl.conn AbstractPooledConnAdapter getRoute

List of usage examples for org.apache.http.impl.conn AbstractPooledConnAdapter getRoute

Introduction

In this page you can find the example usage for org.apache.http.impl.conn AbstractPooledConnAdapter getRoute.

Prototype

public HttpRoute getRoute() 

Source Link

Usage

From source file:com.cedarsoft.couchdb.test.utils.CouchDbRule.java

public void ensureConnectionsClosed() {
    assert client != null;
    try {/*w  w w . j  a  v a 2s.  com*/
        //Ensure client is empty
        ApacheHttpClient4Handler clientHandler = ((ApacheHttpClient4) client).getClientHandler();
        SingleClientConnManager connectionManager = (SingleClientConnManager) clientHandler.getHttpClient()
                .getConnectionManager();
        @Nullable
        AbstractPooledConnAdapter managedConn = (AbstractPooledConnAdapter) Reflection.field("managedConn")
                .ofType(Class.forName("org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter"))
                .in(connectionManager).get();
        if (managedConn != null) {
            throw new IllegalStateException("Connection not closed properly: " + managedConn.getRoute());
        }
    } catch (ClassNotFoundException e) {
        throw new RuntimeException(e);
    }
}