@@ -90,7 +90,7 @@ protected void releaseNativeHandle() {}
9090
9191 /**
9292 * Create a new builder with mTLS file paths
93- *
93+ *
9494 * @param certPath - Path to certificate, in PEM format
9595 * @param privateKeyPath - Path to private key, in PEM format
9696 */
@@ -102,7 +102,7 @@ public static AwsIotMqttConnectionBuilder newMtlsBuilderFromPath(String certPath
102102
103103 /**
104104 * Create a new builder with mTLS cert pair in memory
105- *
105+ *
106106 * @param certificate - Certificate, in PEM format
107107 * @param privateKey - Private key, in PEM format
108108 */
@@ -114,7 +114,7 @@ public static AwsIotMqttConnectionBuilder newMtlsBuilder(String certificate, Str
114114
115115 /**
116116 * Create a new builder with mTLS cert pair in memory
117- *
117+ *
118118 * @param certificate - Certificate, in PEM format
119119 * @param privateKey - Private key, in PEM format
120120 */
@@ -137,7 +137,7 @@ public static AwsIotMqttConnectionBuilder newDefaultBuilder()
137137
138138 /**
139139 * Overrides the default system trust store.
140- *
140+ *
141141 * @param caDirPath - Only used on Unix-style systems where all trust anchors
142142 * are stored in a directory (e.g. /etc/ssl/certs).
143143 * @param caFilePath - Single file containing all trust CAs, in PEM format
@@ -150,7 +150,7 @@ public AwsIotMqttConnectionBuilder withCertificateAuthorityFromPath(String caDir
150150
151151 /**
152152 * Overrides the default system trust store.
153- *
153+ *
154154 * @param caRoot - Buffer containing all trust CAs, in PEM format
155155 */
156156 public AwsIotMqttConnectionBuilder withCertificateAuthority (String caRoot ) {
@@ -161,7 +161,7 @@ public AwsIotMqttConnectionBuilder withCertificateAuthority(String caRoot) {
161161
162162 /**
163163 * Configures the IoT endpoint for connections from this builder.
164- *
164+ *
165165 * @param endpoint The IoT endpoint to connect to
166166 */
167167 public AwsIotMqttConnectionBuilder withEndpoint (String endpoint ) {
@@ -172,7 +172,7 @@ public AwsIotMqttConnectionBuilder withEndpoint(String endpoint) {
172172 /**
173173 * Configures the port to connect to for connections from this builder. If not set, 443 will be used for
174174 * a websocket connection or where ALPN support is available. Otherwise the default is 8883.
175- *
175+ *
176176 * @param port The port to connect to on the IoT endpoint. Usually 8883 for
177177 * MQTT, or 443 for websockets
178178 */
@@ -183,7 +183,7 @@ public AwsIotMqttConnectionBuilder withPort(short port) {
183183
184184 /**
185185 * Configures the client id to use to connect to the IoT Core service.
186- *
186+ *
187187 * @param clientId The client id for connections from this builder. Needs to be unique across
188188 * all devices/clients.
189189 */
@@ -195,7 +195,7 @@ public AwsIotMqttConnectionBuilder withClientId(String clientId) {
195195 /**
196196 * Configures whether or not the service should try to resume prior
197197 * subscriptions, if it has any
198- *
198+ *
199199 * @param cleanSession true if the session should drop prior subscriptions when
200200 * a connection from this builder is established, false to resume the session
201201 */
@@ -207,7 +207,7 @@ public AwsIotMqttConnectionBuilder withCleanSession(boolean cleanSession) {
207207 /**
208208 * Configures MQTT keep-alive via PING messages. Note that this is not TCP
209209 * keepalive.
210- *
210+ *
211211 * @param keepAliveMs How often in milliseconds to send an MQTT PING message to the
212212 * service to keep connections alive
213213 */
@@ -230,7 +230,7 @@ public AwsIotMqttConnectionBuilder withPingTimeoutMs(int pingTimeoutMs) {
230230
231231 /**
232232 * Configures the TCP socket connect timeout (in milliseconds)
233- *
233+ *
234234 * @param timeoutMs TCP socket timeout
235235 */
236236 public AwsIotMqttConnectionBuilder withTimeoutMs (int timeoutMs ) {
@@ -240,7 +240,7 @@ public AwsIotMqttConnectionBuilder withTimeoutMs(int timeoutMs) {
240240
241241 /**
242242 * Configures the common settings for the socket to use for connections created by this builder
243- *
243+ *
244244 * @param socketOptions The socket settings
245245 */
246246 public AwsIotMqttConnectionBuilder withSocketOptions (SocketOptions socketOptions ) {
@@ -283,19 +283,24 @@ public AwsIotMqttConnectionBuilder withConnectionEventCallbacks(MqttClientConnec
283283 * disconnects
284284 *
285285 * @param message The message to publish as the will. The message contains the
286- * topic that the message will be published to on disconnect.
287- * @param qos The {@link QualityOfService} of the will message
288- * @param retain Whether or not the message should be retained by the mqtt broker to
289- * be delivered to future subscribers
286+ * topic that the message will be published to on disconnect,
287+ * along with the {@link QualityOfService} that it will be
288+ * published with and whether it will be retained when it is published.
290289 */
291- public AwsIotMqttConnectionBuilder withWill (MqttMessage message , QualityOfService qos , boolean retain ) throws MqttException {
290+ public AwsIotMqttConnectionBuilder withWill (MqttMessage message ) throws MqttException {
292291 this .config .setWillMessage (message );
293- this .config .setWillQos (qos );
294- this .config .setWillRetain (retain );
295292
296293 return this ;
297294 }
298295
296+ /**
297+ * @deprecated Use alternate withWill(). QoS and retain are now set directly on the {@link MqttMessage}
298+ */
299+ @ Deprecated
300+ public AwsIotMqttConnectionBuilder withWill (MqttMessage message , QualityOfService qos , boolean retain ) throws MqttException {
301+ return withWill (new MqttMessage (message .getTopic (), message .getPayload (), qos , retain ));
302+ }
303+
299304 /**
300305 * Configures the client bootstrap to use for connections created by this builder
301306 *
0 commit comments