protected function validateScheme($scheme)
    {
        if (!$scheme) {
            throw new InvalidArgumentException('No scheme specified');
        }
        if (!in_array($scheme, self::$schemes)) {
            throw new InvalidArgumentException(
                'Unknown socket scheme: ' . $scheme
            );
        }

        if ($scheme == self::SCHEME_WEBSOCKET_SECURE) {
            return self::SCHEME_UNDERLYING_SECURE;
        }
        return self::SCHEME_UNDERLYING;
    }