|
22 | 22 | import com.hivemq.client.internal.mqtt.message.auth.mqtt3.Mqtt3SimpleAuthView; |
23 | 23 | import com.hivemq.client.internal.mqtt.message.connect.MqttConnect; |
24 | 24 | import com.hivemq.client.internal.mqtt.message.connect.MqttConnectRestrictions; |
25 | | -import com.hivemq.client.internal.mqtt.message.connect.MqttConnectRestrictionsBuilder; |
26 | 25 | import com.hivemq.client.internal.mqtt.message.publish.MqttWillPublish; |
27 | 26 | import com.hivemq.client.internal.mqtt.message.publish.mqtt3.Mqtt3PublishView; |
28 | | -import com.hivemq.client.internal.util.Checks; |
29 | 27 | import com.hivemq.client.mqtt.mqtt3.message.auth.Mqtt3SimpleAuth; |
30 | 28 | import com.hivemq.client.mqtt.mqtt3.message.connect.Mqtt3Connect; |
31 | 29 | import com.hivemq.client.mqtt.mqtt3.message.connect.Mqtt3ConnectRestrictions; |
32 | 30 | import com.hivemq.client.mqtt.mqtt3.message.publish.Mqtt3Publish; |
33 | | -import com.hivemq.client.mqtt.mqtt5.message.connect.Mqtt5ConnectRestrictions; |
34 | 31 | import org.jetbrains.annotations.NotNull; |
35 | 32 | import org.jetbrains.annotations.Nullable; |
36 | 33 |
|
|
42 | 39 | @Immutable |
43 | 40 | public class Mqtt3ConnectView implements Mqtt3Connect { |
44 | 41 |
|
45 | | - public static final @NotNull Mqtt3ConnectView DEFAULT = of(DEFAULT_KEEP_ALIVE, DEFAULT_CLEAN_SESSION, null, null, MqttConnectRestrictions.DEFAULT); |
| 42 | + public static final @NotNull Mqtt3ConnectView DEFAULT = |
| 43 | + of(DEFAULT_KEEP_ALIVE, DEFAULT_CLEAN_SESSION, MqttConnectRestrictions.DEFAULT, null, null); |
46 | 44 |
|
47 | 45 | private static @NotNull MqttConnect delegate( |
48 | 46 | final int keepAlive, |
49 | 47 | final boolean cleanSession, |
| 48 | + final @NotNull MqttConnectRestrictions restrictions, |
50 | 49 | final @Nullable MqttSimpleAuth simpleAuth, |
51 | | - final @Nullable MqttWillPublish willPublish, |
52 | | - final @NotNull MqttConnectRestrictions restrictions) { |
| 50 | + final @Nullable MqttWillPublish willPublish) { |
53 | 51 |
|
54 | | - return new MqttConnect(keepAlive, cleanSession, cleanSession ? 0 : MqttConnect.NO_SESSION_EXPIRY, |
55 | | - restrictions, simpleAuth, null, willPublish, |
56 | | - MqttUserPropertiesImpl.NO_USER_PROPERTIES); |
| 52 | + return new MqttConnect(keepAlive, cleanSession, cleanSession ? 0 : MqttConnect.NO_SESSION_EXPIRY, restrictions, |
| 53 | + simpleAuth, null, willPublish, MqttUserPropertiesImpl.NO_USER_PROPERTIES); |
57 | 54 | } |
58 | 55 |
|
59 | 56 | static @NotNull Mqtt3ConnectView of( |
60 | 57 | final int keepAlive, |
61 | 58 | final boolean cleanSession, |
| 59 | + final @NotNull MqttConnectRestrictions restrictions, |
62 | 60 | final @Nullable MqttSimpleAuth simpleAuth, |
63 | | - final @Nullable MqttWillPublish willPublish, |
64 | | - final @NotNull MqttConnectRestrictions mqttConnectRestrictions) { |
| 61 | + final @Nullable MqttWillPublish willPublish) { |
65 | 62 |
|
66 | | - return new Mqtt3ConnectView(delegate(keepAlive, cleanSession, simpleAuth, willPublish, mqttConnectRestrictions)); |
| 63 | + return new Mqtt3ConnectView(delegate(keepAlive, cleanSession, restrictions, simpleAuth, willPublish)); |
67 | 64 | } |
68 | 65 |
|
69 | 66 | public static @NotNull Mqtt3ConnectView of(final @NotNull MqttConnect delegate) { |
@@ -123,7 +120,8 @@ public boolean isCleanSession() { |
123 | 120 | private @NotNull String toAttributeString() { |
124 | 121 | final Mqtt3SimpleAuth simpleAuth = getRawSimpleAuth(); |
125 | 122 | final Mqtt3Publish willPublish = getRawWillPublish(); |
126 | | - return "keepAlive=" + getKeepAlive() + ", cleanSession=" + isCleanSession() + |
| 123 | + final Mqtt3ConnectRestrictions restrictions = getRestrictions(); |
| 124 | + return "keepAlive=" + getKeepAlive() + ", cleanSession=" + isCleanSession() + ", restrictions=" + restrictions + |
127 | 125 | ((simpleAuth == null) ? "" : ", simpleAuth=" + simpleAuth) + |
128 | 126 | ((willPublish == null) ? "" : ", willPublish=" + willPublish); |
129 | 127 | } |
|
0 commit comments