public NetworkClient(Settings settings, TransportFactory transportFactory) {
    this.settings = settings.copy();
    this.nodes = SettingsUtils.discoveredOrDeclaredNodes(settings);
    this.transportFactory = transportFactory;

    // shuffle the list of nodes so in case of failures, the fallback is spread
    Collections.shuffle(nodes);

    if (SettingsUtils.hasPinnedNode(settings)) {
      // move pinned node in front to be selected (only once)
      String pinnedNode = SettingsUtils.getPinnedNode(settings);

      if (log.isDebugEnabled()) {
        log.debug("Opening (pinned) network client to " + pinnedNode);
      }

      nodes.remove(pinnedNode);
      nodes.add(0, pinnedNode);
    }

    selectNextNode();

    Assert.notNull(currentTransport, "no node information provided");
  }
 private ContentBuilder(Generator generator, ValueWriter writer) {
   Assert.notNull(generator);
   this.generator = generator;
   this.writer = writer;
 }