io.netty.handler.codec.mqtt.MqttUnacceptableProtocolVersionException Java Examples

The following examples show how to use io.netty.handler.codec.mqtt.MqttUnacceptableProtocolVersionException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MqttProtocolUtil.java    From ext-opensource-netty with Mozilla Public License 2.0 5 votes vote down vote up
public static MqttConnectReturnCode connectReturnCodeForException(Throwable cause) {
	MqttConnectReturnCode code = MqttConnectReturnCode.CONNECTION_REFUSED_SERVER_UNAVAILABLE;
	if (cause instanceof MqttUnacceptableProtocolVersionException) {
		// 不支持的协议版本
		code = MqttConnectReturnCode.CONNECTION_REFUSED_UNACCEPTABLE_PROTOCOL_VERSION;
	} else if (cause instanceof MqttIdentifierRejectedException) {
		// 不合格的clientId
		code = MqttConnectReturnCode.CONNECTION_REFUSED_IDENTIFIER_REJECTED;
	} else {
		code = MqttConnectReturnCode.CONNECTION_REFUSED_SERVER_UNAVAILABLE;
	}
	return code;
}