コード例 #1
0
        public void SaslHandshakeResponse(
            [Values(
                 ErrorResponseCode.None,
                 ErrorResponseCode.OffsetMetadataTooLarge
                 )] ErrorResponseCode errorCode,
            [Range(1, 11)] int count)
        {
            var mechanisms = new[] { "EXTERNAL", "ANONYMOUS", "PLAIN", "OTP", "SKEY", "CRAM-MD5", "DIGEST-MD5", "SCRAM", "NTLM", "GSSAPI", "OAUTHBEARER" };
            var response   = new SaslHandshakeResponse(errorCode, mechanisms.Take(count));

            response.AssertCanEncodeDecodeResponse(0);
        }
コード例 #2
0
        public void SaslHandshakeResponse(
            [Values(
                 ErrorCode.NONE,
                 ErrorCode.OFFSET_METADATA_TOO_LARGE
                 )] ErrorCode errorCode,
            [Range(1, 11)] int count)
        {
            var mechanisms = new[] { "EXTERNAL", "ANONYMOUS", "PLAIN", "OTP", "SKEY", "CRAM-MD5", "DIGEST-MD5", "SCRAM", "NTLM", "GSSAPI", "OAUTHBEARER" };
            var response   = new SaslHandshakeResponse(errorCode, mechanisms.Take(count));

            response.AssertCanEncodeDecodeResponse(0);
        }
コード例 #3
0
        private static bool TryEncodeResponse(IKafkaWriter writer, IRequestContext context, SaslHandshakeResponse response)
        {
            if (response == null)
            {
                return(false);
            }

            writer.Write(response.error_code)
            .Write(response.enabled_mechanisms.Count);
            foreach (var mechanism in response.enabled_mechanisms)
            {
                writer.Write(mechanism);
            }
            return(true);
        }