I have the same issue. I tried to use PGConnection pgCon =(PGConnection)((DelegatingConnection)conn).getInnermostDelegate();
But I get
Caused by: java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp2.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to org.apache.commons.dbcp.DelegatingConnection