Skip to content

Commit e808574

Browse files
Test proto mismatch on both ends.
1 parent bab689c commit e808574

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/unit/socket-zap-test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,21 +152,33 @@ for (const proto of testProtos("tcp", "ipc")) {
152152
/* ZMQ < 4.3.0 does not have these event details. */
153153
if (semver.satisfies(zmq.version, "< 4.3.0")) this.skip()
154154

155+
this.slow(250)
156+
155157
sockA.plainServer = true
156158
sockB.curveServer = true
157159

158160
const address = uniqAddress(proto)
159-
const [eventA] = await Promise.all([
161+
const [eventA, eventB] = await Promise.all([
160162
captureEvent(sockA, "handshake:error:protocol"),
163+
captureEvent(sockB, "handshake:error:protocol"),
161164
sockA.bind(address),
162165
sockB.connect(address),
163166
])
164167

165168
assert.equal(eventA.type, "handshake:error:protocol")
169+
assert.equal(eventB.type, "handshake:error:protocol")
170+
166171
assert.equal(eventA.address, address)
172+
assert.equal(eventB.address, address)
173+
167174
assert.instanceOf(eventA.error, Error)
175+
assert.instanceOf(eventB.error, Error)
176+
168177
assert.equal(eventA.error.message, "ZMTP protocol error")
178+
assert.equal(eventB.error.message, "ZMTP protocol error")
179+
169180
assert.equal(eventA.error.code, "ERR_ZMTP_MECHANISM_MISMATCH")
181+
assert.equal(eventB.error.code, "ERR_ZMTP_MECHANISM_MISMATCH")
170182
})
171183
})
172184
})

0 commit comments

Comments
 (0)