public static IGremlinQueryExecutionPipelineBuilderWithExecutor <GroovySerializedGremlinQuery, JToken> AddWebSocketExecutor(
            this IGremlinQueryExecutionPipelineBuilderWithSerializer <GroovySerializedGremlinQuery> builder,
            string hostname,
            int port        = 8182,
            bool enableSsl  = false,
            string username = null,
            string password = null,
            GraphsonVersion graphsonVersion = GraphsonVersion.V2,
            IReadOnlyDictionary <Type, IGraphSONSerializer> additionalGraphsonSerializers       = null,
            IReadOnlyDictionary <string, IGraphSONDeserializer> additionalGraphsonDeserializers = null,
            ILogger logger = null)
        {
            var actualAdditionalGraphsonSerializers   = additionalGraphsonSerializers ?? ImmutableDictionary <Type, IGraphSONSerializer> .Empty;
            var actualAdditionalGraphsonDeserializers = additionalGraphsonDeserializers ?? ImmutableDictionary <string, IGraphSONDeserializer> .Empty;

            return(builder
                   .AddWebSocketExecutor(
                       () => new GremlinClient(
                           new GremlinServer(hostname, port, enableSsl, username, password),
                           graphsonVersion == GraphsonVersion.V2
                            ? new GraphSON2Reader(actualAdditionalGraphsonDeserializers)
                            : (GraphSONReader) new GraphSON3Reader(actualAdditionalGraphsonDeserializers),
                           graphsonVersion == GraphsonVersion.V2
                            ? new GraphSON2Writer(actualAdditionalGraphsonSerializers)
                            : (GraphSONWriter) new GraphSON3Writer(actualAdditionalGraphsonSerializers),
                           graphsonVersion == GraphsonVersion.V2
                            ? GremlinClient.GraphSON2MimeType
                            : GremlinClient.DefaultMimeType),
                       logger));
        }
 public static IGremlinQueryExecutionPipelineBuilderWithExecutor <GroovySerializedGremlinQuery, JToken> AddWebSocketExecutor(this IGremlinQueryExecutionPipelineBuilderWithSerializer <GroovySerializedGremlinQuery> builder, Func <IGremlinClient> clientFactory, ILogger logger = null)
 {
     return(builder
            .UseExecutor(new WebSocketGremlinQueryExecutor(clientFactory, logger)));
 }