public Manager(URI uri, Options opts) { if (opts == null) { opts = new Options(); } if (opts.path == null) { opts.path = "/socket.io"; } if (opts.sslContext == null) { opts.sslContext = defaultSSLContext; } if (opts.hostnameVerifier == null) { opts.hostnameVerifier = defaultHostnameVerifier; } this.opts = opts; this.nsps = new ConcurrentHashMap<String, Socket>(); this.subs = new LinkedList<On.Handle>(); this.reconnection(opts.reconnection); this.reconnectionAttempts( opts.reconnectionAttempts != 0 ? opts.reconnectionAttempts : Integer.MAX_VALUE); this.reconnectionDelay(opts.reconnectionDelay != 0 ? opts.reconnectionDelay : 1000); this.reconnectionDelayMax(opts.reconnectionDelayMax != 0 ? opts.reconnectionDelayMax : 5000); this.randomizationFactor(opts.randomizationFactor != 0.0 ? opts.randomizationFactor : 0.5); this.backoff = new Backoff() .setMin(this.reconnectionDelay()) .setMax(this.reconnectionDelayMax()) .setJitter(this.randomizationFactor()); this.timeout(opts.timeout); this.readyState = ReadyState.CLOSED; this.uri = uri; this.encoding = false; this.packetBuffer = new ArrayList<Packet>(); this.encoder = new Parser.Encoder(); this.decoder = new Parser.Decoder(); }