When we use @JUnitTemporaryDatabase in unit tests, our temporary PostgreSQL database calls DataSourceFactory.setInstance(database) to set itself as the default javax.sql.DataSource. However, this means that there is no connection pooling using c3p0 during the unit tests. This is leading to socket exceptions during some database-intensive unit tests because hundreds of database connections are being opened and closed quickly enough to exhaust the available ephemeral client ports.
We need to change TemporaryDatabaseExecutionListener to wrap the datasource in a c3p0 pool.
This probably isn't an issue with atomikos since its javax.sql.DataSource is implemented using a pooled javax.sql.XADataSource resource.