title: How to determine if java.sql.Connection is valid with PostgreSQL JDBC4
body: <p>I'm trying write a test for a method that returns a java.sql.Connection to connect to a PostgreSQL.</p>
  
  <p>My test is very straightforward:  </p>
  
  <pre><code>@Test
  public void connectionFactoryShouldReturnOpenConnection() throws Exception {
      Connection conn = ConnectionFactory.getConnection();
  
      assertTrue(conn.isValid(2));
  }
  </code></pre>
  
  <p>The <code>isValid</code> call fails, though:</p>
  
  <pre><code>org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.
  at org.postgresql.Driver.notImplemented(Driver.java:753)
  at org.postgresql.jdbc4.AbstractJdbc4Connection.isValid(AbstractJdbc4Connection.java:109)
  at org.postgresql.jdbc4.Jdbc4Connection.isValid(Jdbc4Connection.java:21)
  </code></pre>
  
  <p>What's going on?  Surely there is a PostgreSQL JDBC driver that implements the methods of Java 1.6 such as <code>isValid()</code>?</p>
  
  <p>Here the details on the driver I'm using:</p>
  
  <pre><code>&lt;groupId&gt;postgresql&lt;/groupId&gt;
  &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
  &lt;version&gt;9.0-801.jdbc4&lt;/version&gt;
  </code></pre>