Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Commit f63bd8d

Browse files
committed
Verify connectivity to get the right error message for neo4j protocol
1 parent 58a701e commit f63bd8d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cypher-shell/src/integration-test/java/org/neo4j/shell/MainIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void wrongPortWithBolt() throws Exception
8888
main.connectMaybeInteractively( shell, connectionConfig, true );
8989
}
9090

91-
@Ignore
91+
@Test
9292
public void wrongPortWithNeo4j() throws Exception
9393
{
9494
// given
@@ -103,7 +103,7 @@ public void wrongPortWithNeo4j() throws Exception
103103
ConnectionConfig connectionConfig = sac.connectionConfig;
104104

105105
exception.expect( ServiceUnavailableException.class );
106-
exception.expectMessage( "Unable to connect to localhost:1234, ensure the database is running and that there is a working network connection to it" );
106+
exception.expectMessage( "Unable to connect to database, ensure the database is running and that there is a working network connection to it" );
107107
main.connectMaybeInteractively( shell, connectionConfig, true );
108108
}
109109

cypher-shell/src/main/java/org/neo4j/shell/state/BoltStateHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ private void reconnect() {
172172
}
173173

174174
private void reconnect(boolean keepBookmark) {
175+
// This will already throw an exception if there is no connectivity
176+
driver.verifyConnectivity();
177+
175178
SessionConfig.Builder builder = SessionConfig.builder();
176179
builder.withDefaultAccessMode( AccessMode.WRITE );
177180
if ( !ABSENT_DB_NAME.equals( activeDatabaseNameAsSetByUser ) )

0 commit comments

Comments
 (0)