Use the Transactional Driver to get a JDBC connection (this returns a ConnectionImple which wraps the connection to the real resource and enlists/delists it with transactions). After running about 500 transactions the underlying resource throws an error reporting "Too many connections" (I tried this on Derby and MySql XA drivers).
The real connection is implemented by RecoverableXAConnection - when a transaction completes the reference to the real connection is nulled (and therefore not closed) so on the next transaction a new connection is obtained so the resource manager eventually runs out of connections.