Repository: neo4j-contrib/neo4j-jdbc
Pull request #116 (2017-12-04 16:11:55)

issue #90 - Implemented DataSource
Added unit tests and integration test.

**Fixed an error in the documentation and a bug in some classes that were not using 'nossl' lowercase.**


Patch:
diff --git a/README.adoc b/README.adoc
index 5c429327..eea7d1ae 100644
--- a/README.adoc
+++ b/README.adoc
@@ -94,7 +94,7 @@ try (Connection con = DriverManager.getConnection("jdbc:neo4j:bolt://localhost",
 
 * Install a Neo4j 3.2.x server and start it with the Bolt protocol enabled
 * Connect with URLs in the form `jdbc:neo4j:bolt://<host>:<port>/` (e.g. `jdbc:neo4j:bolt://localhost/`)
-* You can also use additional comma separated parameters in the URL for authentication, debug mode, SSL encryption and flattening e.g. `jdbc:neo4j:bolt://localhost/?user=neo4j,password=xxxx,debug=true,noSsl,flatten=[-1,100,1000]`
+* You can also use additional comma separated parameters in the URL for authentication, debug mode, SSL encryption and flattening e.g. `jdbc:neo4j:bolt://localhost/?user=neo4j,password=xxxx,debug=true,nossl,flatten=[-1,100,1000]`
 
 * Add the JDBC driver dependency or jar file to your project
 * Get a connection from `DriverManager`
diff --git a/docs/index.html b/docs/index.html
index 6aa69c51..c0ab89d1 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -615,7 +615,7 @@ try (Connection con = DriverManager.getConnection("jdbc:neo4j:bolt://localhost",
 <p>Connect with URLs in the form <code>jdbc:neo4j:bolt://&lt;host&gt;:&lt;port&gt;/</code> (e.g. <code>jdbc:neo4j:bolt://localhost/</code>)</p>
 </li>
 <li>
-<p>You can also use additional comma separated parameters in the URL for authentication, debug mode, SSL encryption and flattening e.g. <code>jdbc:neo4j:bolt://localhost/?user=neo4j,password=xxxx,debug=true,noSsl,flatten=[-1,100,1000]</code></p>
+<p>You can also use additional comma separated parameters in the URL for authentication, debug mode, SSL encryption and flattening e.g. <code>jdbc:neo4j:bolt://localhost/?user=neo4j,password=xxxx,debug=true,nossl,flatten=[-1,100,1000]</code></p>
 </li>
 <li>
 <p>Add the JDBC driver dependency or jar file to your project</p>
@@ -1874,7 +1874,7 @@ Just replace its content by this one (don&#8217;t forget to replace the jdbc url
 
 	&lt;dataSource type="JdbcDataSource"
 				driver="org.neo4j.jdbc.Driver"
-				url="jdbc:neo4j:bolt://localhost?noSsl"
+				url="jdbc:neo4j:bolt://localhost?nossl"
 				user="neo4j"
 				password="test" /&gt;
 
@@ -1918,4 +1918,4 @@ Last updated 2017-05-14 01:53:56 CEST
 </div>
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/docs/solr.adoc b/docs/solr.adoc
index 09231d1e..55f14256 100644
--- a/docs/solr.adoc
+++ b/docs/solr.adoc
@@ -52,7 +52,7 @@ Just replace its content by this one (don't forget to replace the jdbc url, logi
 
 	<dataSource type="JdbcDataSource"
 				driver="org.neo4j.jdbc.Driver"
-				url="jdbc:neo4j:bolt://localhost?noSsl"
+				url="jdbc:neo4j:bolt://localhost?nossl"
 				user="neo4j"
 				password="test" />
 
diff --git a/index.html b/index.html
index 5d8b1246..80be35c7 100644
--- a/index.html
+++ b/index.html
@@ -615,7 +615,7 @@ try (Connection con = DriverManager.getConnection("jdbc:neo4j:bolt://localhost",
 <p>Connect with URLs in the form <code>jdbc:neo4j:bolt://&lt;host&gt;:&lt;port&gt;/</code> (e.g. <code>jdbc:neo4j:bolt://localhost/</code>)</p>
 </li>
 <li>
-<p>You can also use additional comma separated parameters in the URL for authentication, debug mode, SSL encryption and flattening e.g. <code>jdbc:neo4j:bolt://localhost/?user=neo4j,password=xxxx,debug=true,noSsl,flatten=[-1,100,1000]</code></p>
+<p>You can also use additional comma separated parameters in the URL for authentication, debug mode, SSL encryption and flattening e.g. <code>jdbc:neo4j:bolt://localhost/?user=neo4j,password=xxxx,debug=true,nossl,flatten=[-1,100,1000]</code></p>
 </li>
 <li>
 <p>Add the JDBC driver dependency or jar file to your project</p>
@@ -1874,7 +1874,7 @@ Just replace its content by this one (don&#8217;t forget to replace the jdbc url
 
 	&lt;dataSource type="JdbcDataSource"
 				driver="org.neo4j.jdbc.Driver"
-				url="jdbc:neo4j:bolt://localhost?noSsl"
+				url="jdbc:neo4j:bolt://localhost?nossl"
 				user="neo4j"
 				password="test" /&gt;
 
diff --git a/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/BoltNeo4jDataSource.java b/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/BoltNeo4jDataSource.java
new file mode 100644
index 00000000..0ffaf0ce
--- /dev/null
+++ b/neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/bolt/BoltNeo4jDataSource.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2016 LARUS Business Automation [http://www.larus-ba.it]
+ * <p>
+ * This file is part of the "LARUS Integration Framework for Neo4j".
+ * <p>
+ * The "LARUS Integration Framework for Neo4j" is licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * <p>
+ * Created on 01/12/17
+ */
+package org.neo4j.jdbc.bolt;
+
+import org.neo4j.jdbc.Neo4jDataSource;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+/**
+ * @author AgileLARUS
+ *
+ * @since 3.0.0
+ */
+public class BoltNeo4jDataSource extends Neo4jDataSource {
+
+	private static final String PROTOCOL = "bolt";
+
+	@Override public Connection getConnection() throws SQLException {
+		return getConnection(user, password);
+	}
+
+	@Override public Connection getConnection(String username, String pass) throws SQLException {
+		setUser(username);
+		setPassword(pass);
+		return DriverManager.getConnection(getUrl(PROTOCOL));
+	}
+}
diff --git a/neo4j-jdbc-examples/mybatis/src/main/resources/database-config.xml b/neo4j-jdbc-examples/mybatis/src/main/resources/database-config.xml
index 0e99205a..7fcb3a71 100755
--- a/neo4j-jdbc-examples/mybatis/src/main/resources/database-config.xml
+++ b/neo4j-jdbc-examples/mybatis/src/main/resources/database-config.xml
@@ -7,7 +7,7 @@
 			<transactionManager type="JDBC" />
 			<dataSource type="POOLED">
 				<property name="driver" value="org.neo4j.jdbc.bolt.BoltNeo4jDriver" />
-				<property name="url" value="jdbc:neo4j:bolt://localhost?noSsl" />
+				<property name="url" value="jdbc:neo4j:bolt://localhost?nossl" />
 				<property name="username" value="neo4j" />
 				<property name="password" value="neo4j" />
 			</dataSource>
diff --git a/neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jDataSource.java b/neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jDataSource.java
index 8e53b310..2202d8f1 100644
--- a/neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jDataSource.java
+++ b/neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jDataSource.java
@@ -22,23 +22,38 @@ package org.neo4j.jdbc;
 import org.neo4j.jdbc.utils.ExceptionBuilder;
 
 import java.io.PrintWriter;
-import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
+import java.util.Objects;
 import java.util.logging.Logger;
 
 /**
  * @author AgileLARUS
- * @since 3.0.0
+ * @since 3.2.0
  */
-abstract class Neo4jDataSource implements javax.sql.DataSource {
+public abstract class Neo4jDataSource implements javax.sql.DataSource {
 
-	@Override public Connection getConnection() throws SQLException {
-		throw ExceptionBuilder.buildUnsupportedOperationException();
-	}
+	public static final String NEO4J_JDBC_PREFIX = "jdbc:neo4j:";
+	protected           String serverName        = "localhost";
+	protected String user;
+	protected String password;
+	protected int     portNumber = 0;
+	protected boolean isSsl      = false;
 
-	@Override public Connection getConnection(String username, String password) throws SQLException {
-		throw ExceptionBuilder.buildUnsupportedOperationException();
+	/*
+	 * Ensure the driver is loaded as JDBC Driver might be invisible to Java's ServiceLoader.
+	 * Usually, {@code Class.forName(...)} is not required as {@link DriverManager} detects JDBC drivers
+	 * via {@code META-INF/services/java.sql.Driver} entries. However there might be cases when the driver
+	 * is located at the application level classloader, thus it might be required to perform manual
+	 * registration of the driver.
+	 */
+	static {
+		try {
+			Class.forName("org.neo4j.jdbc.Neo4jDriver");
+		} catch (ClassNotFoundException e) {
+			throw new IllegalStateException(
+					"Neo4jDataSource is unable to load org.neo4j.jdbc.Neo4jDriver. Please check if you have proper Neo4j JDBC Driver jar on the classpath", e);
+		}
 	}
 
 	@Override public PrintWriter getLogWriter() throws SQLException {
@@ -68,4 +83,57 @@ abstract class Neo4jDataSource implements javax.sql.DataSource {
 	@Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
 		return Wrapper.isWrapperFor(iface, this.getClass());
 	}
+
+	public String getServerName() {
+		return serverName;
+	}
+
+	public void setServerName(String serverName) {
+		this.serverName = serverName;
+	}
+
+	public String getUser() {
+		return user;
+	}
+
+	public void setUser(String user) {
+		this.user = user;
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	public int getPortNumber() {
+		return portNumber;
+	}
+
+	public void setPortNumber(int portNumber) {
+		this.portNumber = portNumber;
+	}
+
+	public String getUrl(String protocol) {
+		String url = NEO4J_JDBC_PREFIX + protocol + "://" + getServerName() + ((getPortNumber() > 0) ? ":" + getPortNumber() : "") + "?" + ((!getIsSsl()) ?
+				"nossl," :
+				"");
+		if (Objects.nonNull(getUser())) {
+			url += "user=" + getUser();
+			if (Objects.nonNull(getPassword())) {
+				url += ",password=" + getPassword();
+			}
+		}
+		return url;
+	}
+
+	public boolean getIsSsl() {
+		return this.isSsl;
+	}
+
+	public void setIsSsl(boolean ssl) {
+		this.isSsl = ssl;
+	}
 }
diff --git a/neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jResultSet.java b/neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jResultSet.java
index 3d42f099..71710dbe 100644
--- a/neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jResultSet.java
+++ b/neo4j-jdbc/src/main/java/org/neo4j/jdbc/Neo4jResultSet.java
@@ -52,18 +52,20 @@ public abstract class Neo4jResultSet implements java.sql.ResultSet {
 	/**
 	 * Check if the connection is closed or not.
 	 * If it is, we throw an exception.
+	 *
+	 * @throws SQLException if the {@link Neo4jResultSet} is closed
 	 */
 	protected void checkClosed() throws SQLException {
 		if (this.isClosed()) {
-			throw new SQLException("Statement already closed");
+			throw new SQLException("ResultSet already closed");
 		}
 	}
 
 	/**
 	 * Check if the ResultSet is closed.
 	 *
-	 * @return
-	 * @throws SQLException
+	 * @return <code>true</code> if <code>ResultSet</code> is closed.
+	 * @throws SQLException in case of problems when checking if closed.
 	 */
 	@Override public boolean isClosed() throws SQLException {
 		return this.isClosed;
diff --git a/neo4j-jdbc/src/main/java/org/neo4j/jdbc/utils/PreparedStatementBuilder.java b/neo4j-jdbc/src/main/java/org/neo4j/jdbc/utils/PreparedStatementBuilder.java
index fa4c7b83..d75fea4a 100644
--- a/neo4j-jdbc/src/main/java/org/neo4j/jdbc/utils/PreparedStatementBuilder.java
+++ b/neo4j-jdbc/src/main/java/org/neo4j/jdbc/utils/PreparedStatementBuilder.java
@@ -37,8 +37,8 @@ public class PreparedStatementBuilder {
 	 * <br>
 	 * i.e. MATCH n RETURN n WHERE n.name = ? is transformed in MATCH n RETURN n WHERE n.name = {1}
 	 *
-	 * @param raw
-	 * @return
+	 * @param raw The string to be translated.
+	 * @return The string with the placeholders replaced.
 	 */
 	public static String replacePlaceholders(String raw) {
 		int index = 1;
@@ -58,8 +58,8 @@ public class PreparedStatementBuilder {
 	/**
 	 * Given a string (statement) it counts all valid placeholders
 	 *
-	 * @param raw
-	 * @return
+	 * @param raw The string of the statement
+	 * @return The number of all valid placeholders
 	 */
 	public static int namedParameterCount(String raw) {
 		int max = 0;
diff --git a/neo4j-jdbc/src/main/java/org/neo4j/jdbc/utils/TimeLimitedCodeBlock.java b/neo4j-jdbc/src/main/java/org/neo4j/jdbc/utils/TimeLimitedCodeBlock.java
index 1c128f00..4c576b2f 100644
--- a/neo4j-jdbc/src/main/java/org/neo4j/jdbc/utils/TimeLimitedCodeBlock.java
+++ b/neo4j-jdbc/src/main/java/org/neo4j/jdbc/utils/TimeLimitedCodeBlock.java
@@ -37,9 +37,9 @@ public class TimeLimitedCodeBlock {
 	 * @param runnable The runnable to run
 	 * @param timeout The maximum time a run should last
 	 * @param timeUnit The <code>TimeUnit</code> unit for the timeout
-	 * @throws Exception Any exception thrown by the runnable or a <code>TimeoutException</code>
+	 * @throws Neo4jJdbcRuntimeException Any exception thrown by the runnable wrapped.
 	 */
-	public static void runWithTimeout(final Runnable runnable, long timeout, TimeUnit timeUnit) throws Neo4jJdbcRuntimeException {
+	public static void runWithTimeout(final Runnable runnable, long timeout, TimeUnit timeUnit) {
 		ExecutorService executor = Executors.newSingleThreadExecutor();
 		Future future = executor.submit(runnable);
 		executor.shutdown();


Test patch:
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jAuthenticationIT.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jAuthenticationIT.java
index deba9744..a2142bb2 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jAuthenticationIT.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jAuthenticationIT.java
@@ -85,30 +85,30 @@ public class BoltNeo4jAuthenticationIT {
 	@Test public void shouldNotAuthenticateBecauseOfABadUserAndPassword() throws SQLException {
 		expectedEx.expect(SQLException.class);
 		expectedEx.expectMessage("The client is unauthorized due to authentication failure.");
-		DriverManager.getConnection(NEO4J_JDBC_BOLT_URL + "?noSsl,user=teapot,password=teapot");
+		DriverManager.getConnection(NEO4J_JDBC_BOLT_URL + "?nossl,user=teapot,password=teapot");
 	}
 
 	@Test public void shouldNotAuthenticateBecauseOfABadUser() throws SQLException {
 		expectedEx.expect(SQLException.class);
 		expectedEx.expectMessage("The client is unauthorized due to authentication failure.");
-		DriverManager.getConnection(NEO4J_JDBC_BOLT_URL + "?noSsl,user=teapot,password=neo4j");
+		DriverManager.getConnection(NEO4J_JDBC_BOLT_URL + "?nossl,user=teapot,password=neo4j");
 	}
 
 	@Test public void shouldNotAuthenticateBecauseOfABadPassword() throws SQLException {
 		expectedEx.expect(SQLException.class);
 		expectedEx.expectMessage("The client is unauthorized due to authentication failure.");
-		DriverManager.getConnection(NEO4J_JDBC_BOLT_URL + "?noSsl,user=neo4j,password=teapot");
+		DriverManager.getConnection(NEO4J_JDBC_BOLT_URL + "?nossl,user=neo4j,password=teapot");
 	}
 
 	@Test public void shouldNotAuthenticateBecauseNoUserAndPasswordAreProvided() throws SQLException {
 		expectedEx.expect(SQLException.class);
 		expectedEx.expectMessage("Unsupported authentication token, missing key `credentials`");
-		DriverManager.getConnection(NEO4J_JDBC_BOLT_URL + "?noSsl");
+		DriverManager.getConnection(NEO4J_JDBC_BOLT_URL + "?nossl");
 	}
 
 	@Test public void shouldNotAuthenticateBecauseNoPasswordIsProvided() throws SQLException {
 		expectedEx.expect(SQLException.class);
 		expectedEx.expectMessage("Unsupported authentication token, missing key `credentials`");
-		DriverManager.getConnection(NEO4J_JDBC_BOLT_URL + "?noSsl,user=neo4j");
+		DriverManager.getConnection(NEO4J_JDBC_BOLT_URL + "?nossl,user=neo4j");
 	}
 }
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jConnectionIT.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jConnectionIT.java
index 5633848d..4640a29b 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jConnectionIT.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jConnectionIT.java
@@ -19,11 +19,6 @@
  */
 package org.neo4j.jdbc.bolt;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
 import java.sql.DriverManager;
@@ -34,13 +29,12 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.*;
 import org.junit.rules.ExpectedException;
 import org.neo4j.jdbc.bolt.data.StatementData;
 
+import static org.junit.Assert.*;
+
 /**
  * @author AgileLARUS
  * @since 3.0.0
@@ -277,4 +271,22 @@ public class BoltNeo4jConnectionIT {
 			}
 		}
 	}
+
+	@Test
+	public void multipleRunShouldNotFail() {
+
+		for (int i = 0; i < 1000; i++) {
+			try (Connection connection = DriverManager.getConnection(NEO4J_JDBC_BOLT_URL)) {
+				try (Statement statement = connection.createStatement();
+						ResultSet resultSet = statement.executeQuery("match (n) return count(n) as countOfNodes")) {
+					if(resultSet.next()) {
+						resultSet.getObject("countOfNodes");
+					}
+				}
+			}
+			catch (Exception e) {
+				fail(e.getMessage());
+			}
+		}
+	}
 }
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDataSourceIT.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDataSourceIT.java
new file mode 100644
index 00000000..6e76ae19
--- /dev/null
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDataSourceIT.java
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2016 LARUS Business Automation [http://www.larus-ba.it]
+ * <p>
+ * This file is part of the "LARUS Integration Framework for Neo4j".
+ * <p>
+ * The "LARUS Integration Framework for Neo4j" is licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * <p>
+ * Created on 01/12/17
+ */
+package org.neo4j.jdbc.bolt;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author AgileLARUS
+ *
+ * @since 3.0.0
+ */
+public class BoltNeo4jDataSourceIT {
+	@Rule
+	public ExpectedException expectedEx = ExpectedException.none();
+
+	@ClassRule
+	public static Neo4jBoltRule neo4j = new Neo4jBoltRule();
+
+	/*------------------------------*/
+	/*        getConnection         */
+	/*------------------------------*/
+
+	@Test public void getConnectionShouldWork() throws SQLException {
+
+		BoltNeo4jDataSource boltNeo4jDataSource = new BoltNeo4jDataSource();
+		boltNeo4jDataSource.setServerName(neo4j.getHost());
+		boltNeo4jDataSource.setPortNumber(neo4j.getPort());
+
+		Connection connection = boltNeo4jDataSource.getConnection();
+		assertNotNull(connection);
+
+		Statement statement = connection.createStatement();
+		assertTrue(statement.execute("RETURN 1"));
+	}
+}
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDatabaseMetaDataIT.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDatabaseMetaDataIT.java
index 4dfb3a5f..931d9a09 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDatabaseMetaDataIT.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDatabaseMetaDataIT.java
@@ -43,7 +43,7 @@ public class BoltNeo4jDatabaseMetaDataIT {
 	@Rule public Neo4jBoltRule neo4j = new Neo4jBoltRule();
 
 	@Test public void getDatabaseVersionShouldBeOK() throws SQLException, NoSuchFieldException, IllegalAccessException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl","user","password");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl","user","password");
 
 		assertNotNull(connection.getMetaData().getDatabaseProductVersion());
 		assertNotEquals(-1, connection.getMetaData().getDatabaseMajorVersion());
@@ -54,7 +54,7 @@ public class BoltNeo4jDatabaseMetaDataIT {
 	}
 
 	@Test public void getDatabaseLabelsShouldBeOK() throws SQLException, NoSuchFieldException, IllegalAccessException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl","user","password");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl","user","password");
 
 		try (Statement statement = connection.createStatement()) {
 			statement.execute("create (a:A {one:1, two:2})");
@@ -74,7 +74,7 @@ public class BoltNeo4jDatabaseMetaDataIT {
 	}
 
 	@Test public void classShouldWorkIfTransactionIsAlreadyOpened() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl","user","password");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl","user","password");
 		connection.setAutoCommit(false);
 		connection.getMetaData();
 
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDriverTest.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDriverTest.java
index 40424197..9280562f 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDriverTest.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jDriverTest.java
@@ -33,6 +33,7 @@ import org.neo4j.driver.v1.AuthTokens;
 import org.neo4j.driver.v1.Config;
 import org.neo4j.driver.v1.GraphDatabase;
 import org.neo4j.jdbc.Neo4jDriver;
+import org.neo4j.jdbc.bolt.utils.Mocker;
 import org.powermock.api.mockito.PowerMockito;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
@@ -64,9 +65,7 @@ import static org.powermock.api.mockito.PowerMockito.verifyStatic;
 	private static org.neo4j.driver.v1.Driver mockedDriver;
 
 	@BeforeClass public static void initialize() {
-		mockedDriver = mock(org.neo4j.driver.v1.Driver.class);
-		ConnectionProvider connectionProvider = mock(ConnectionProvider.class, RETURNS_MOCKS);
-		Mockito.when(mockedDriver.session()).thenReturn(new NetworkSession(connectionProvider, AccessMode.READ,null, DevNullLogging.DEV_NULL_LOGGING));
+		mockedDriver = Mocker.mockDriver();
 	}
 
 	/*------------------------------*/
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jPreparedStatementIT.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jPreparedStatementIT.java
index af87e4df..b1c8ea8c 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jPreparedStatementIT.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jPreparedStatementIT.java
@@ -51,7 +51,7 @@ public class BoltNeo4jPreparedStatementIT {
 
 	@Test public void executeQueryShouldExecuteAndReturnCorrectData() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE_TWO_PROPERTIES);
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		PreparedStatement statement = connection.prepareStatement(StatementData.STATEMENT_MATCH_ALL_STRING_PARAMETRIC);
 		statement.setString(1, "test");
 		ResultSet rs = statement.executeQuery();
@@ -65,7 +65,7 @@ public class BoltNeo4jPreparedStatementIT {
 
 	@Test public void executeQueryWithNamedParamShouldExecuteAndReturnCorrectData() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE_TWO_PROPERTIES);
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		PreparedStatement statement = connection.prepareStatement(StatementData.STATEMENT_MATCH_ALL_STRING_PARAMETRIC_NAMED);
 		statement.setString(1, "test");
 		ResultSet rs = statement.executeQuery();
@@ -81,7 +81,7 @@ public class BoltNeo4jPreparedStatementIT {
 	/*         executeUpdate        */
 	/*------------------------------*/
 	@Test public void executeUpdateShouldExecuteAndReturnCorrectData() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		PreparedStatement statement = connection.prepareStatement(StatementData.STATEMENT_CREATE_TWO_PROPERTIES_PARAMETRIC);
 		statement.setString(1, "test1");
 		statement.setString(2, "test2");
@@ -105,7 +105,7 @@ public class BoltNeo4jPreparedStatementIT {
 	/*------------------------------*/
 	@Test public void executeShouldExecuteAndReturnTrue() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE_TWO_PROPERTIES);
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		PreparedStatement statement = connection.prepareStatement(StatementData.STATEMENT_MATCH_ALL_STRING_PARAMETRIC);
 		statement.setString(1, "test");
 		boolean result = statement.execute();
@@ -121,7 +121,7 @@ public class BoltNeo4jPreparedStatementIT {
 	}
 
 	@Test public void executeShouldExecuteAndReturnFalse() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		PreparedStatement statement = connection.prepareStatement(StatementData.STATEMENT_CREATE_TWO_PROPERTIES_PARAMETRIC);
 		statement.setString(1, "test1");
 		statement.setString(2, "test2");
@@ -143,7 +143,7 @@ public class BoltNeo4jPreparedStatementIT {
 	/*         executeBatch         */
 	/*------------------------------*/
 	@Test public void executeBatchShouldWork() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		PreparedStatement statement = connection.prepareStatement(StatementData.STATEMENT_CREATE_TWO_PROPERTIES_PARAMETRIC);
 		connection.setAutoCommit(true);
 		statement.setString(1, "test1");
@@ -166,7 +166,7 @@ public class BoltNeo4jPreparedStatementIT {
 	}
 
 	@Test public void executeBatchShouldWorkWhenError() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		connection.setAutoCommit(true);
 		PreparedStatement statement = connection.prepareStatement("wrong cypher statement ?");
 		statement.setString(1, "test1");
@@ -189,7 +189,7 @@ public class BoltNeo4jPreparedStatementIT {
 	}
 
 	@Test public void executeBatchShouldWorkWithTransaction() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		PreparedStatement statement = connection.prepareStatement(StatementData.STATEMENT_CREATE_TWO_PROPERTIES_PARAMETRIC);
 		connection.setAutoCommit(false);
 		statement.setString(1, "test1");
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jResultSetIT.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jResultSetIT.java
index f6127213..83d80864 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jResultSetIT.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jResultSetIT.java
@@ -47,7 +47,7 @@ public class BoltNeo4jResultSetIT {
 		neo4j.getGraphDatabase().execute("CREATE (:User {name:\"name\"})");
 		neo4j.getGraphDatabase().execute("CREATE (:User {surname:\"surname\"})");
 
-		Connection conn = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl,flatten=1");
+		Connection conn = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl,flatten=1");
 		Statement stmt = conn.createStatement();
 
 		ResultSet rs = stmt.executeQuery("MATCH (u:User) RETURN u;");
@@ -64,7 +64,7 @@ public class BoltNeo4jResultSetIT {
 		neo4j.getGraphDatabase().execute("CREATE (:User {name:\"name\"})");
 		neo4j.getGraphDatabase().execute("CREATE (:User {surname:\"surname\"})");
 
-		Connection conn = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl,flatten=2");
+		Connection conn = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl,flatten=2");
 		Statement stmt = conn.createStatement();
 
 		ResultSet rs = stmt.executeQuery("MATCH (u:User) RETURN u;");
@@ -85,7 +85,7 @@ public class BoltNeo4jResultSetIT {
 		neo4j.getGraphDatabase().execute("CREATE (:User {name:\"name\"})");
 		neo4j.getGraphDatabase().execute("CREATE (:User {surname:\"surname\"})");
 
-		Connection conn = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl,flatten=-1");
+		Connection conn = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl,flatten=-1");
 		Statement stmt = conn.createStatement();
 
 		ResultSet rs = stmt.executeQuery("MATCH (u:User) RETURN u;");
@@ -105,7 +105,7 @@ public class BoltNeo4jResultSetIT {
 	@Test public void findColumnShouldWorkWithFlattening() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE);
 
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl,flatten=1");
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl,flatten=1");
 		Statement stmt = con.createStatement();
 		ResultSet rs = stmt.executeQuery(StatementData.STATEMENT_MATCH_NODES);
 
@@ -119,7 +119,7 @@ public class BoltNeo4jResultSetIT {
 	@Test public void shouldGetRowReturnValidNumbers() throws SQLException {
 		neo4j.getGraphDatabase().execute("unwind range(1,5) as x create (:User{number:x})");
 
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		Statement stmt = con.createStatement();
 		ResultSet rs = stmt.executeQuery("match (u:User) return u.number as number order by number asc");
 
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jResultSetMetaDataIT.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jResultSetMetaDataIT.java
index 2d6a680e..9844f39c 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jResultSetMetaDataIT.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jResultSetMetaDataIT.java
@@ -65,7 +65,7 @@ public class BoltNeo4jResultSetMetaDataIT {
 	@Test public void shouldAddVirtualColumnsOnNodeWithMultipleNodes() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE_OTHER_TYPE_AND_RELATIONS);
 
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl," + FLATTEN_URI);
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl," + FLATTEN_URI);
 
 		try (Statement stmt = con.createStatement()) {
 			ResultSet rs = stmt.executeQuery(StatementData.STATEMENT_MATCH_NODES_MORE);
@@ -92,7 +92,7 @@ public class BoltNeo4jResultSetMetaDataIT {
 	}
 
 	@Test public void shouldAddVirtualColumnsOnNodeAndPreserveResultSet() throws SQLException {
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl," + FLATTEN_URI);
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl," + FLATTEN_URI);
 
 		try (Statement stmt = con.createStatement()) {
 			ResultSet rs = stmt.executeQuery(StatementData.STATEMENT_MATCH_NODES);
@@ -114,7 +114,7 @@ public class BoltNeo4jResultSetMetaDataIT {
 	}
 
 	@Test public void shouldNotAddVirtualColumnsOnNodeIfNotOnlyNodes() throws SQLException {
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl," + FLATTEN_URI);
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl," + FLATTEN_URI);
 
 		try (Statement stmt = con.createStatement()) {
 			ResultSet rs = stmt.executeQuery(StatementData.STATEMENT_MATCH_MISC);
@@ -130,7 +130,7 @@ public class BoltNeo4jResultSetMetaDataIT {
 	@Test public void shouldAddVirtualColumnsOnRelationsWithMultipleRelations() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE_OTHER_TYPE_AND_RELATIONS);
 
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl," + FLATTEN_URI);
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl," + FLATTEN_URI);
 
 		try (Statement stmt = con.createStatement()) {
 			ResultSet rs = stmt.executeQuery(StatementData.STATEMENT_MATCH_RELATIONS);
@@ -152,7 +152,7 @@ public class BoltNeo4jResultSetMetaDataIT {
 	@Test public void shouldAddVirtualColumnsOnRelationsAndNodesWithMultiple() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE_OTHER_TYPE_AND_RELATIONS);
 
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl," + FLATTEN_URI);
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl," + FLATTEN_URI);
 
 		try (Statement stmt = con.createStatement()) {
 			ResultSet rs = stmt.executeQuery(StatementData.STATEMENT_MATCH_NODES_RELATIONS);
@@ -183,7 +183,7 @@ public class BoltNeo4jResultSetMetaDataIT {
 	@Test public void getColumnTypeShouldSucceed() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE);
 
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 
 		try (Statement stmt = con.createStatement()) {
 			ResultSet rs = stmt.executeQuery("MATCH (n) return 'a',1,1.0,[1,2,3],{a:1},null,n,n.name");
@@ -231,7 +231,7 @@ public class BoltNeo4jResultSetMetaDataIT {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE);
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE_OTHER_TYPE_AND_RELATIONS);
 
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl," + FLATTEN_URI);
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl," + FLATTEN_URI);
 
 		try (Statement stmt = con.createStatement()) {
 			ResultSet rs = stmt.executeQuery(StatementData.STATEMENT_MATCH_NODES_RELATIONS);
@@ -265,7 +265,7 @@ public class BoltNeo4jResultSetMetaDataIT {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE);
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE_OTHER_TYPE_AND_RELATIONS);
 
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl," + FLATTEN_URI);
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl," + FLATTEN_URI);
 
 		try (Statement stmt = con.createStatement()) {
 			ResultSet rs = stmt.executeQuery(StatementData.STATEMENT_MATCH_NODES_RELATIONS);
@@ -298,7 +298,7 @@ public class BoltNeo4jResultSetMetaDataIT {
 
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE);
 
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 
 		try (Statement stmt = con.createStatement()) {
 			ResultSet rs = stmt.executeQuery(StatementData.STATEMENT_MATCH_NODES);
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jStatementIT.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jStatementIT.java
index 27d6a537..5e672278 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jStatementIT.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/BoltNeo4jStatementIT.java
@@ -55,7 +55,7 @@ public class BoltNeo4jStatementIT {
 	/*------------------------------*/
 	@Test public void executeQueryShouldExecuteAndReturnCorrectData() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE);
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		Statement statement = connection.createStatement();
 		ResultSet rs = statement.executeQuery(StatementData.STATEMENT_MATCH_ALL_STRING);
 
@@ -68,7 +68,7 @@ public class BoltNeo4jStatementIT {
 
 	@Test public void executeQueryShouldExecuteAndReturnCorrectDataOnAutoCommitFalseStatement() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE);
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		Statement statement = connection.createStatement();
 		connection.setAutoCommit(false);
 
@@ -84,7 +84,7 @@ public class BoltNeo4jStatementIT {
 
 	@Test public void executeQueryShouldExecuteAndReturnCorrectDataOnAutoCommitFalseStatementAndCreatedWithParams() throws SQLException {
 		neo4j.getGraphDatabase().execute(StatementData.STATEMENT_CREATE);
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		Statement statement = connection.createStatement(Neo4jResultSet.TYPE_FORWARD_ONLY, Neo4jResultSet.CONCUR_READ_ONLY);
 		connection.setAutoCommit(false);
 
@@ -102,7 +102,7 @@ public class BoltNeo4jStatementIT {
 	/*         executeUpdate        */
 	/*------------------------------*/
 	@Test public void executeUpdateShouldExecuteAndReturnCorrectData() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		Statement statement = connection.createStatement();
 		int lines = statement.executeUpdate(StatementData.STATEMENT_CREATE);
 		assertEquals(1, lines);
@@ -120,7 +120,7 @@ public class BoltNeo4jStatementIT {
 	/*            execute           */
 	/*------------------------------*/
 	@Test public void executeShouldExecuteAndReturnFalse() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		Statement statement = connection.createStatement();
 		boolean result = statement.execute(StatementData.STATEMENT_CREATE);
 		assertFalse(result);
@@ -132,7 +132,7 @@ public class BoltNeo4jStatementIT {
 	}
 
 	@Test public void executeShouldExecuteAndReturnTrue() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		Statement statement = connection.createStatement();
 		boolean result = statement.execute(StatementData.STATEMENT_MATCH_ALL);
 		assertTrue(result);
@@ -144,7 +144,7 @@ public class BoltNeo4jStatementIT {
 		expectedEx.expect(SQLException.class);
 		expectedEx.expectMessage("Invalid input");
 
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 
 		Statement statement = connection.createStatement();
 		try {
@@ -159,7 +159,7 @@ public class BoltNeo4jStatementIT {
 		expectedEx.expect(SQLException.class);
 		expectedEx.expectMessage("Invalid input");
 
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		connection.setAutoCommit(false);
 
 		Statement statement = connection.createStatement();
@@ -175,7 +175,7 @@ public class BoltNeo4jStatementIT {
 	/*         executeBatch         */
 	/*------------------------------*/
 	@Test public void executeBatchShouldWork() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		Statement statement = connection.createStatement();
 		connection.setAutoCommit(true);
 		statement.addBatch(StatementData.STATEMENT_CREATE);
@@ -192,7 +192,7 @@ public class BoltNeo4jStatementIT {
 	}
 
 	@Test public void executeBatchShouldWorkWhenError() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		connection.setAutoCommit(true);
 		Statement statement = connection.createStatement();
 		statement.addBatch(StatementData.STATEMENT_CREATE);
@@ -212,7 +212,7 @@ public class BoltNeo4jStatementIT {
 	}
 
 	@Test public void executeBatchShouldWorkWithTransaction() throws SQLException {
-		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 		Statement statement = connection.createStatement();
 		connection.setAutoCommit(false);
 		statement.addBatch(StatementData.STATEMENT_CREATE);
@@ -244,7 +244,7 @@ public class BoltNeo4jStatementIT {
 	/*             close            */
 	/*------------------------------*/
 	@Test public void closeShouldNotCloseTransaction() throws SQLException {
-		try (Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl")) {
+		try (Connection connection = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl")) {
 			connection.setAutoCommit(false);
 
 			Statement statement = connection.createStatement();
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/Neo4jBoltRule.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/Neo4jBoltRule.java
index a55e0a19..03699d26 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/Neo4jBoltRule.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/Neo4jBoltRule.java
@@ -27,6 +27,8 @@ public class Neo4jBoltRule implements TestRule {
 
 	private       String               hostAndPort;
 	private       GraphDatabaseService graphDatabase;
+	private String host;
+	private int port;
 	private final boolean              requireAuth;
 
 	public Neo4jBoltRule() {
@@ -47,8 +49,9 @@ public class Neo4jBoltRule implements TestRule {
 				settings.put(boltConnector.type, GraphDatabaseSettings.Connector.ConnectorType.BOLT.name());
 				settings.put(boltConnector.encryption_level, DISABLED.name());
 				settings.put(GraphDatabaseSettings.auth_enabled, Boolean.toString(requireAuth));
-
 				InetSocketAddress inetAddr = new InetSocketAddress("localhost", getFreePort());
+				host = inetAddr.getHostName();
+				port = inetAddr.getPort();
 				hostAndPort = String.format("%s:%d", inetAddr.getHostName(), inetAddr.getPort());
 				settings.put(boltConnector.listen_address, hostAndPort);
 				graphDatabase = new TestGraphDatabaseFactory().newImpermanentDatabase(settings);
@@ -69,6 +72,14 @@ public class Neo4jBoltRule implements TestRule {
 		return graphDatabase;
 	}
 
+	public int getPort() {
+		return port;
+	}
+
+	public String getHost() {
+		return host;
+	}
+
 	private int getFreePort() throws IOException {
 		try (ServerSocket socket = new ServerSocket(0)) {
 			socket.setReuseAddress(true);
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/SampleIT.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/SampleIT.java
index 192cb666..ff1e8183 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/SampleIT.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/SampleIT.java
@@ -59,7 +59,7 @@ public class SampleIT {
 		neo4j.getGraphDatabase().execute("create (:User{name:\"testUser\"})");
 
 		// Connect
-		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?noSsl");
+		Connection con = DriverManager.getConnection("jdbc:neo4j:" + neo4j.getBoltUrl() + "?nossl");
 
 		// Querying
 		try (Statement stmt = con.createStatement()) {
diff --git a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/utils/Mocker.java b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/utils/Mocker.java
index d95b57b8..47657755 100644
--- a/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/utils/Mocker.java
+++ b/neo4j-jdbc-bolt/src/test/java/org/neo4j/jdbc/bolt/utils/Mocker.java
@@ -19,11 +19,13 @@
  */
 package org.neo4j.jdbc.bolt.utils;
 
+import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
-import org.neo4j.driver.v1.Session;
-import org.neo4j.driver.v1.StatementResult;
-import org.neo4j.driver.v1.Transaction;
+import org.neo4j.driver.internal.NetworkSession;
+import org.neo4j.driver.internal.logging.DevNullLogging;
+import org.neo4j.driver.internal.spi.ConnectionProvider;
+import org.neo4j.driver.v1.*;
 import org.neo4j.jdbc.bolt.BoltNeo4jConnection;
 
 import java.sql.ResultSet;
@@ -33,6 +35,7 @@ import java.util.concurrent.TimeUnit;
 
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.RETURNS_MOCKS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -103,4 +106,11 @@ public class Mocker {
 		when(mockConnection.getTransaction()).thenReturn(mockTransaction);
 		return mockConnection;
 	}
+
+	public static Driver mockDriver() {
+		Driver mockedDriver = mock(org.neo4j.driver.v1.Driver.class);
+		ConnectionProvider connectionProvider = mock(ConnectionProvider.class, RETURNS_MOCKS);
+		Mockito.when(mockedDriver.session()).thenReturn(new NetworkSession(connectionProvider, AccessMode.READ,null, DevNullLogging.DEV_NULL_LOGGING));
+		return mockedDriver;
+	}
 }
diff --git a/neo4j-jdbc-driver/src/test/java/org/neo4j/jdbc/DriverTestIT.java b/neo4j-jdbc-driver/src/test/java/org/neo4j/jdbc/DriverTestIT.java
index 821ba580..6bb62e2e 100644
--- a/neo4j-jdbc-driver/src/test/java/org/neo4j/jdbc/DriverTestIT.java
+++ b/neo4j-jdbc-driver/src/test/java/org/neo4j/jdbc/DriverTestIT.java
@@ -64,7 +64,7 @@ public class DriverTestIT {
 
 	@Test public void shouldReturnABoltConnection() throws Exception {
 		Driver driver = new Driver();
-		Connection connection = driver.connect("jdbc:neo4j:" + neo4j.boltURI() + "/?noSsl", new Properties());
+		Connection connection = driver.connect("jdbc:neo4j:" + neo4j.boltURI() + "/?nossl", new Properties());
 		Assert.assertTrue(connection instanceof BoltNeo4jConnection);
 	}
 
diff --git a/neo4j-jdbc-examples/mybatis/src/test/java/org/neo4j/jdbc/example/mybatis/MybatisTestUtil.java b/neo4j-jdbc-examples/mybatis/src/test/java/org/neo4j/jdbc/example/mybatis/MybatisTestUtil.java
index 206c0191..1a6f11a1 100644
--- a/neo4j-jdbc-examples/mybatis/src/test/java/org/neo4j/jdbc/example/mybatis/MybatisTestUtil.java
+++ b/neo4j-jdbc-examples/mybatis/src/test/java/org/neo4j/jdbc/example/mybatis/MybatisTestUtil.java
@@ -55,7 +55,7 @@ public class MybatisTestUtil {
 	}
 
 	protected void buildMybatisConfiguration(String protocol, String host, int port) {
-		DataSource dataSource = new UnpooledDataSource("org.neo4j.jdbc.Driver", "jdbc:neo4j:" + protocol + "://" + host + ":" + port + "?noSsl", null);
+		DataSource dataSource = new UnpooledDataSource("org.neo4j.jdbc.Driver", "jdbc:neo4j:" + protocol + "://" + host + ":" + port + "?nossl", null);
 		TransactionFactory transactionFactory = new JdbcTransactionFactory();
 		Environment environment = new Environment("development", transactionFactory, dataSource);
 
diff --git a/neo4j-jdbc-examples/mybatis/src/test/resources/bolt-database-config.xml b/neo4j-jdbc-examples/mybatis/src/test/resources/bolt-database-config.xml
index 80ac5cc6..2a902618 100755
--- a/neo4j-jdbc-examples/mybatis/src/test/resources/bolt-database-config.xml
+++ b/neo4j-jdbc-examples/mybatis/src/test/resources/bolt-database-config.xml
@@ -8,7 +8,7 @@
 			<transactionManager type="JDBC" />
 			<dataSource type="POOLED">
 				<property name="driver" value="org.neo4j.jdbc.Driver" />
-				<property name="url" value="jdbc:neo4j:bolt://localhost?noSsl" />
+				<property name="url" value="jdbc:neo4j:bolt://localhost?nossl" />
 				<property name="username" value="neo4j" />
 				<property name="password" value="neo4j" />
 			</dataSource>
diff --git a/neo4j-jdbc-examples/mybatis/src/test/resources/http-database-config.xml b/neo4j-jdbc-examples/mybatis/src/test/resources/http-database-config.xml
index e79f5d73..b36ee88a 100755
--- a/neo4j-jdbc-examples/mybatis/src/test/resources/http-database-config.xml
+++ b/neo4j-jdbc-examples/mybatis/src/test/resources/http-database-config.xml
@@ -8,7 +8,7 @@
 			<transactionManager type="JDBC" />
 			<dataSource type="POOLED">
 				<property name="driver" value="org.neo4j.jdbc.Driver" />
-				<property name="url" value="jdbc:neo4j:http://localhost?noSsl" />
+				<property name="url" value="jdbc:neo4j:http://localhost?nossl" />
 				<property name="username" value="neo4j" />
 				<property name="password" value="neo4j" />
 			</dataSource>
diff --git a/neo4j-jdbc/src/test/java/org/neo4j/jdbc/Neo4jDataSourceTest.java b/neo4j-jdbc/src/test/java/org/neo4j/jdbc/Neo4jDataSourceTest.java
index f7c5173a..9eaabebc 100644
--- a/neo4j-jdbc/src/test/java/org/neo4j/jdbc/Neo4jDataSourceTest.java
+++ b/neo4j-jdbc/src/test/java/org/neo4j/jdbc/Neo4jDataSourceTest.java
@@ -19,6 +19,7 @@
  */
 package org.neo4j.jdbc;
 
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -37,26 +38,29 @@ public class Neo4jDataSourceTest {
 
 	@Rule public ExpectedException expectedEx = ExpectedException.none();
 
+	private Neo4jDataSource dataSource;
+
+	@Before public void setUp() {
+		this.dataSource = mock(Neo4jDataSource.class, Mockito.CALLS_REAL_METHODS);
+		this.dataSource.setServerName("localhost"); //a protected non static non final variable is not initialized in a mock.
+	}
+
 	/*------------------------------*/
 	/*         isWrapperFor         */
 	/*------------------------------*/
 
 	@Test public void isWrapperForShouldReturnTrue() throws SQLException {
-		Neo4jDataSource dataSource = mock(Neo4jDataSource.class, Mockito.CALLS_REAL_METHODS);
-
-		assertTrue(dataSource.isWrapperFor(Neo4jDataSource.class));
-		assertTrue(dataSource.isWrapperFor(javax.sql.DataSource.class));
-		assertTrue(dataSource.isWrapperFor(javax.sql.CommonDataSource.class));
-		assertTrue(dataSource.isWrapperFor(java.sql.Wrapper.class));
+		assertTrue(this.dataSource.isWrapperFor(Neo4jDataSource.class));
+		assertTrue(this.dataSource.isWrapperFor(javax.sql.DataSource.class));
+		assertTrue(this.dataSource.isWrapperFor(javax.sql.CommonDataSource.class));
+		assertTrue(this.dataSource.isWrapperFor(java.sql.Wrapper.class));
 	}
 
 	@Test public void isWrapperForShouldReturnFalse() throws SQLException {
-		Neo4jDataSource dataSource = mock(Neo4jDataSource.class, Mockito.CALLS_REAL_METHODS);
-
-		assertFalse(dataSource.isWrapperFor(Neo4jResultSet.class));
-		assertFalse(dataSource.isWrapperFor(java.sql.Driver.class));
-		assertFalse(dataSource.isWrapperFor(Neo4jResultSet.class));
-		assertFalse(dataSource.isWrapperFor(java.sql.ResultSet.class));
+		assertFalse(this.dataSource.isWrapperFor(Neo4jResultSet.class));
+		assertFalse(this.dataSource.isWrapperFor(java.sql.Driver.class));
+		assertFalse(this.dataSource.isWrapperFor(Neo4jResultSet.class));
+		assertFalse(this.dataSource.isWrapperFor(java.sql.ResultSet.class));
 	}
 
 	/*------------------------------*/
@@ -64,19 +68,37 @@ public class Neo4jDataSourceTest {
 	/*------------------------------*/
 
 	@Test public void unwrapShouldReturnCorrectClass() throws SQLException {
-		Neo4jDataSource dataSource = mock(Neo4jDataSource.class, Mockito.CALLS_REAL_METHODS);
-
-		assertNotNull(dataSource.unwrap(Neo4jDataSource.class));
-		assertNotNull(dataSource.unwrap(javax.sql.DataSource.class));
-		assertNotNull(dataSource.unwrap(javax.sql.CommonDataSource.class));
-		assertNotNull(dataSource.unwrap(java.sql.Wrapper.class));
+		assertNotNull(this.dataSource.unwrap(Neo4jDataSource.class));
+		assertNotNull(this.dataSource.unwrap(javax.sql.DataSource.class));
+		assertNotNull(this.dataSource.unwrap(javax.sql.CommonDataSource.class));
+		assertNotNull(this.dataSource.unwrap(java.sql.Wrapper.class));
 	}
 
 	@Test public void unwrapShouldThrowException() throws SQLException {
 		expectedEx.expect(SQLException.class);
 
-		Neo4jDataSource dataSource = mock(Neo4jDataSource.class, Mockito.CALLS_REAL_METHODS);
+		this.dataSource.unwrap(Neo4jResultSet.class);
+	}
+
+	/*------------------------------*/
+	/*            getURL            */
+	/*------------------------------*/
+	@Test public void getUrlTest() throws SQLException {
+		this.dataSource.setIsSsl(false);
+		this.dataSource.setUser("test");
+
+		assertEquals("jdbc:neo4j:bolt://localhost?nossl,user=test", this.dataSource.getUrl("bolt"));
 
-		dataSource.unwrap(Neo4jResultSet.class);
+		this.dataSource.setIsSsl(true);
+		assertEquals("jdbc:neo4j:bolt://localhost?user=test", this.dataSource.getUrl("bolt"));
+
+		this.dataSource.setPassword("password");
+		this.dataSource.setIsSsl(false);
+		assertEquals("jdbc:neo4j:bolt://localhost?nossl,user=test,password=password", this.dataSource.getUrl("bolt"));
+		assertEquals("jdbc:neo4j:http://localhost?nossl,user=test,password=password", this.dataSource.getUrl("http"));
+
+		this.dataSource.setPortNumber(7687);
+		assertEquals("jdbc:neo4j:bolt://localhost:7687?nossl,user=test,password=password", this.dataSource.getUrl("bolt"));
 	}
+
 }
diff --git a/neo4j-jdbc/src/test/java/org/neo4j/jdbc/Neo4jDriverTest.java b/neo4j-jdbc/src/test/java/org/neo4j/jdbc/Neo4jDriverTest.java
index 61a449dd..fe102400 100644
--- a/neo4j-jdbc/src/test/java/org/neo4j/jdbc/Neo4jDriverTest.java
+++ b/neo4j-jdbc/src/test/java/org/neo4j/jdbc/Neo4jDriverTest.java
@@ -30,7 +30,7 @@ public class Neo4jDriverTest {
     public void acceptsURL() throws Exception {
         assertTrue(neo4jDriver.acceptsURL("jdbc:neo4j:http://localhost"));
         assertTrue(neo4jDriver.acceptsURL("jdbc:neo4j:http://localhost:7373"));
-        assertTrue(neo4jDriver.acceptsURL("jdbc:neo4j:http://localhost:7373?noSSL"));
+        assertTrue(neo4jDriver.acceptsURL("jdbc:neo4j:http://localhost:7373?nossl"));
         assertTrue(neo4jDriver.acceptsURL("jdbc:neo4j:http://localhost:7373?user=neo4j"));
         assertTrue(neo4jDriver.acceptsURL("jdbc:neo4j:http://localhost:7373?user=neo4j,password=test"));
         assertFalse(neo4jDriver.acceptsURL("jdbc:mysql://localhost:3306/sakila"));