In theory (dependin on how the driver was written), it may be possible to
test Connection.isClosed() before using the Connection - but this neither guaranteed nor recommended.
The description for isClosed also says:
This method generally cannot be called to determine whether a connection to a database is valid or invalid. A typical client can determine that a connection is invalid by catching any exceptions that might be thrown when an operation is attempted.
Basically it is the Connection Pool's job to ensure the validity of any Connection before it hands it out. One mechanism to accomplish this (used in earlier WebLogic servers, no idea if it still does) is to give the pool a valid, light SQL statement it can execute. This statement can be run periodically to test whether the Connection returns values correctly or if it throws exceptions.
Dave