@@ -211,14 +211,15 @@ def protocol_handlers(cls, protocol_version=None):
211211
212212 # Carry out Bolt subclass imports locally to avoid circular dependency issues.
213213 from neo4j .io ._bolt3 import Bolt3
214- from neo4j .io ._bolt4 import Bolt4x0 , Bolt4x1 , Bolt4x2 , Bolt4x3
214+ from neo4j .io ._bolt4 import Bolt4x0 , Bolt4x1 , Bolt4x2 , Bolt4x3 , Bolt4x4
215215
216216 handlers = {
217217 Bolt3 .PROTOCOL_VERSION : Bolt3 ,
218218 Bolt4x0 .PROTOCOL_VERSION : Bolt4x0 ,
219219 Bolt4x1 .PROTOCOL_VERSION : Bolt4x1 ,
220220 Bolt4x2 .PROTOCOL_VERSION : Bolt4x2 ,
221221 Bolt4x3 .PROTOCOL_VERSION : Bolt4x3 ,
222+ Bolt4x4 .PROTOCOL_VERSION : Bolt4x4 ,
222223 }
223224
224225 if protocol_version is None :
@@ -310,33 +311,38 @@ def open(cls, address, *, auth=None, timeout=None, routing_context=None, **pool_
310311 keep_alive = pool_config .keep_alive ,
311312 )
312313
314+ # Carry out Bolt subclass imports locally to avoid circular dependency
315+ # issues.
313316 if pool_config .protocol_version == (3 , 0 ):
314- # Carry out Bolt subclass imports locally to avoid circular dependency issues.
315317 from neo4j .io ._bolt3 import Bolt3
316- connection = Bolt3 ( address , s , pool_config . max_connection_lifetime , auth = auth , user_agent = pool_config . user_agent , routing_context = routing_context )
318+ bolt_cls = Bolt3
317319 elif pool_config .protocol_version == (4 , 0 ):
318- # Carry out Bolt subclass imports locally to avoid circular dependency issues.
319320 from neo4j .io ._bolt4 import Bolt4x0
320- connection = Bolt4x0 ( address , s , pool_config . max_connection_lifetime , auth = auth , user_agent = pool_config . user_agent , routing_context = routing_context )
321+ bolt_cls = Bolt4x0
321322 elif pool_config .protocol_version == (4 , 1 ):
322- # Carry out Bolt subclass imports locally to avoid circular dependency issues.
323323 from neo4j .io ._bolt4 import Bolt4x1
324- connection = Bolt4x1 ( address , s , pool_config . max_connection_lifetime , auth = auth , user_agent = pool_config . user_agent , routing_context = routing_context )
324+ bolt_cls = Bolt4x1
325325 elif pool_config .protocol_version == (4 , 2 ):
326- # Carry out Bolt subclass imports locally to avoid circular dependency issues.
327326 from neo4j .io ._bolt4 import Bolt4x2
328- connection = Bolt4x2 ( address , s , pool_config . max_connection_lifetime , auth = auth , user_agent = pool_config . user_agent , routing_context = routing_context )
327+ bolt_cls = Bolt4x2
329328 elif pool_config .protocol_version == (4 , 3 ):
330- # Carry out Bolt subclass imports locally to avoid circular dependency issues.
331329 from neo4j .io ._bolt4 import Bolt4x3
332- connection = Bolt4x3 (address , s , pool_config .max_connection_lifetime , auth = auth , user_agent = pool_config .user_agent , routing_context = routing_context )
330+ bolt_cls = Bolt4x3
331+ elif pool_config .protocol_version == (4 , 4 ):
332+ from neo4j .io ._bolt4 import Bolt4x4
333+ bolt_cls = Bolt4x4
333334 else :
334335 log .debug ("[#%04X] S: <CLOSE>" , s .getpeername ()[1 ])
335336 _close_socket (s )
336337
337338 supported_versions = Bolt .protocol_handlers ().keys ()
338339 raise BoltHandshakeError ("The Neo4J server does not support communication with this driver. This driver have support for Bolt Protocols {}" .format (supported_versions ), address = address , request_data = handshake , response_data = data )
339340
341+ connection = bolt_cls (
342+ address , s , pool_config .max_connection_lifetime , auth = auth ,
343+ user_agent = pool_config .user_agent , routing_context = routing_context
344+ )
345+
340346 try :
341347 connection .hello ()
342348 except Exception :
0 commit comments