public Disquuun(
            string host,
            int port,
            long bufferSize,
            int minConnectionCount,
            Action <string> ConnectionOpenedAct            = null,
            Action <string, Exception> ConnectionFailedAct = null
            )
        {
            this.connectionId = Guid.NewGuid().ToString();

            this.bufferSize = bufferSize;
            this.endPoint   = new IPEndPoint(IPAddress.Parse(host), port);

            this.connectionState = ConnectionState.OPENING;

            /*
             *                  ConnectionOpened handler treats all connections are opened.
             */
            if (ConnectionOpenedAct != null)
            {
                this.ConnectionOpened = ConnectionOpenedAct;
            }
            else
            {
                this.ConnectionOpened = conId => { }
            };

            /*
             *                  ConnectionFailed handler only treats connection error.
             *
             *                  other runtime errors will emit in API handler.
             */
            if (ConnectionFailedAct != null)
            {
                this.ConnectionFailed = ConnectionFailedAct;
            }
            else
            {
                this.ConnectionFailed = (info, e) => { }
            };

            this.minConnectionCount = minConnectionCount;

            this.socketPool = new DisquuunSocketPool(minConnectionCount, this.OnSocketOpened, this.OnSocketConnectionFailed);

            this.socketPool.Connect(endPoint, bufferSize);
        }
 public DisquuunInput(DisqueCommand command, byte[] data, DisquuunSocketPool socketPool)
 {
     this.command    = command;
     this.data       = data;
     this.socketPool = socketPool;
 }