Phase 2c:SipEncoder + 全 fixture roundtrip 闭环 - #5
Draft
lixuanqun wants to merge 1 commit into
Draft
Conversation
SipEncoder(手写 ByteArrayOutputStream 拼装) - Request-Line / Status-Line:直写 ASCII - Headers:按插入顺序保序输出(保 Via 栈式语义) - 关键不变量:Content-Length 始终由实际 body 长度推导, 即使输入消息携带不一致的 Content-Length 也会被纠正 - Status-Code 用单字符算术输出(避免 String 分配) - header value / reason phrase 走 UTF-8(RFC 3261 §7.3.1) SipEncoderTest(5 个单测) - OPTIONS 请求编码 - 200 OK 响应编码 - Content-Length 与实际 body 长度自动同步 - 缺 Content-Length 时自动注入 - parse→encode→parse 不动语义 ParserConformanceTest 扩展 - 新增 'roundtrip' dynamic-test 系列 - 每个 accept fixture 跑 parse→encode→parse,断言: · body 字节级相等 · start-line(method/URI 或 status/reason)相等 · header count 与 manifest 声明一致 全 6 个 accept fixture 通过 roundtrip: self-test/simple-options, simple-200-ok, invite-with-sdp rfc4475/3.1.1.6-lwsdisp, 3.1.1.9-semiuri, 3.1.1.10-transports mvn verify:9 模块 SUCCESS,33 tests 全绿。 Co-authored-by: li xuanqun <793005378@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
补齐 codec 的"另一半":把
SipMessage写回字节,并让所有 accept fixture 通过parse → encode → parseroundtrip 闸门。实装
SipEncoderRoundtrip 闸门
新增
everyAcceptFixtureRoundtripsThroughEncoder动态测试系列。每个 accept fixture:SipParser.parse(fx.bytes())→SipMessageASipEncoder.encode(A)→ bytes BSipParser.parse(B)→SipMessageC测试