class AbstractClusterNodeConnectionFactory<K, V> implements ClusterNodeConnectionFactory<K, V> {

    private static final InternalLogger logger = InternalLoggerFactory
            .getInstance(PooledClusterConnectionProvider.DefaultClusterNodeConnectionFactory.class);

    private final ClientResources clientResources;

    private volatile Partitions partitions;

    /**
     * Create a new {@link AbstractClusterNodeConnectionFactory} given {@link ClientResources}.
     *
     * @param clientResources must not be {@code null}.
     */
    public AbstractClusterNodeConnectionFactory(ClientResources clientResources) {
        this.clientResources = clientResources;
    }

    public void setPartitions(Partitions partitions) {
        this.partitions = partitions;
    }

    public Partitions getPartitions() {
        return partitions;
    }

    /**
     * Get a {@link Mono} of {@link SocketAddress} for a
     * {@link io.lettuce.core.cluster.ClusterNodeConnectionFactory.ConnectionKey}.
     * <p>
     * This {@link Supplier} resolves the requested endpoint on each {@link Supplier#get()}.
     *
     * @param connectionKey must not be {@code null}.
     * @return
     */
    Mono<SocketAddress> getSocketAddressSupplier(ConnectionKey connectionKey) {

        return Mono.fromCallable(() -> {

            if (connectionKey.nodeId != null) {

                SocketAddress socketAddress = getSocketAddress(connectionKey.nodeId);
                logger.debug("Resolved SocketAddress {} using for Cluster node {}", socketAddress, connectionKey.nodeId);
                return socketAddress;
            }

            SocketAddress socketAddress = resolve(RedisURI.create(connectionKey.host, connectionKey.port));
            logger.debug("Resolved SocketAddress {} using for Cluster node at {}:{}", socketAddress, connectionKey.host,
                    connectionKey.port);
            return socketAddress;
        });
    }

    /**
     * Get the {@link SocketAddress} for a {@code nodeId} from {@link Partitions}.
     *
     * @param nodeId
     * @return the {@link SocketAddress}.
     * @throws IllegalArgumentException if {@code nodeId} cannot be looked up.
     */
    private SocketAddress getSocketAddress(String nodeId) {<FILL_FUNCTION_BODY>}

    private SocketAddress resolve(RedisURI redisURI) {
        return clientResources.socketAddressResolver().resolve(redisURI);
    }

}


        for (RedisClusterNode partition : partitions) {
            if (partition.getNodeId().equals(nodeId)) {
                return resolve(partition.getUri());
            }
        }

        throw new IllegalArgumentException(String.format("Cannot resolve a RedisClusterNode for nodeId %s", nodeId));
    
<no_super_class>