refuseServerProtocolMismatch method
Refuses a server that speaks another Protocol.protocolVersion, and says whether it did.
The server checks the client's version and can answer with an error. The other direction needs this: an older server never read the field and accepted the client anyway, so only the version it echoes back gives it away.
Implementation
@protected
bool refuseServerProtocolMismatch(int serverVersion) {
if (serverVersion == Protocol.protocolVersion) {
return false;
}
refuseBuild(
code: Protocol.errorUnsupportedProtocolVersion,
reason: 'The server speaks protocol version $serverVersion, '
'this client speaks ${Protocol.protocolVersion}.',
);
return true;
}