20
20
import org .jetbrains .annotations .NotNull ;
21
21
import org .jetbrains .annotations .Nullable ;
22
22
23
+ import java .util .Map ;
24
+ import java .util .Objects ;
25
+
23
26
/**
24
27
* @author David Katz
25
28
* @author Christian Hoff
@@ -28,23 +31,26 @@ public class MqttWebSocketConfigImpl implements MqttWebSocketConfig {
28
31
29
32
static final @ NotNull MqttWebSocketConfigImpl DEFAULT =
30
33
new MqttWebSocketConfigImpl (DEFAULT_SERVER_PATH , DEFAULT_QUERY_STRING , DEFAULT_MQTT_SUBPROTOCOL ,
31
- DEFAULT_HANDSHAKE_TIMEOUT_MS );
34
+ DEFAULT_HANDSHAKE_TIMEOUT_MS , DEFAULT_HTTP_HEADERS );
32
35
33
36
private final @ NotNull String serverPath ;
34
37
private final @ NotNull String queryString ;
35
38
private final @ NotNull String subprotocol ;
36
39
private final int handshakeTimeoutMs ;
40
+ private final Map <String , String > httpHeaders ;
37
41
38
42
MqttWebSocketConfigImpl (
39
43
final @ NotNull String serverPath ,
40
44
final @ NotNull String queryString ,
41
45
final @ NotNull String subprotocol ,
42
- final int handshakeTimeoutMs ) {
46
+ final int handshakeTimeoutMs ,
47
+ final @ NotNull Map <String , String > httpHeaders ) {
43
48
44
49
this .serverPath = serverPath ;
45
50
this .queryString = queryString ;
46
51
this .subprotocol = subprotocol ;
47
52
this .handshakeTimeoutMs = handshakeTimeoutMs ;
53
+ this .httpHeaders = httpHeaders ;
48
54
}
49
55
50
56
@ Override
@@ -67,6 +73,11 @@ public int getHandshakeTimeoutMs() {
67
73
return handshakeTimeoutMs ;
68
74
}
69
75
76
+ @ Override
77
+ public @ NotNull Map <String , String > getHttpHeaders () {
78
+ return httpHeaders ;
79
+ }
80
+
70
81
@ Override
71
82
public MqttWebSocketConfigImplBuilder .@ NotNull Default extend () {
72
83
return new MqttWebSocketConfigImplBuilder .Default (this );
@@ -83,7 +94,8 @@ public boolean equals(final @Nullable Object o) {
83
94
final MqttWebSocketConfigImpl that = (MqttWebSocketConfigImpl ) o ;
84
95
85
96
return serverPath .equals (that .serverPath ) && queryString .equals (that .queryString ) &&
86
- subprotocol .equals (that .subprotocol ) && (handshakeTimeoutMs == that .handshakeTimeoutMs );
97
+ subprotocol .equals (that .subprotocol ) && (handshakeTimeoutMs == that .handshakeTimeoutMs ) &&
98
+ Objects .equals (httpHeaders , that .httpHeaders );
87
99
}
88
100
89
101
@ Override
@@ -92,6 +104,7 @@ public int hashCode() {
92
104
result = 31 * result + queryString .hashCode ();
93
105
result = 31 * result + subprotocol .hashCode ();
94
106
result = 31 * result + Integer .hashCode (handshakeTimeoutMs );
107
+ result = 31 * result + httpHeaders .hashCode ();
95
108
return result ;
96
109
}
97
110
}
0 commit comments