/// <summary>
        ///     <para>Initializes a new instance of the <see cref="AsyncSocketClient"/> class.</para>
        /// </summary>
        /// <param name="endPoint">The remote end-point this instance will connect to.</param>
        /// <param name="config">Optional configuration settings. Specify <see langword="null"/> to fallback on reasonable defaults.</param>
        /// <exception cref="ArgumentNullException">
        ///	<para><paramref name="endPoint"/> is <see langword="null"/>.</para>
        /// </exception>
        public AsyncSocketClient(IPEndPoint endPoint, SocketPoolConfig config)
        {
            if (endPoint == null)
            {
                throw new ArgumentNullException("endPoint");
            }

            _socketPool = new SocketPool(endPoint, config ?? new SocketPoolConfig());
        }
 public SocketPool(IPEndPoint remoteEndPoint, SocketPoolConfig config)
 {
     _remoteEndPoint = remoteEndPoint;
     _config         = config;
     _pool           = new Pool <SocketChannel>(
         () => new SocketChannel(_remoteEndPoint, _config.ConnectTimeout),
         (socket, phase) => !socket.HasError,
         _config);
 }