-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConnectPayload.java
97 lines (80 loc) · 2.22 KB
/
ConnectPayload.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
* This class implements the structure of the payload of a CONNECT message.
*/
/**
* INFO0010 - Introduction to Computer Networking @Uliège
* Second part of the assignment
* Academic year 2021-2022
* @author Tristan Catteeuw - s161627 | Brieuc Jamoulle - s151977
*/
public final class ConnectPayload {
private final String userId;
private final String willTopic;
private final String username;
private final String password;
private final byte[] willMessage;
/**
* Constructor of the payload object for the CONNECT message
*
* @param userId Identifies the Client to the Server
* @param willTopic Will topic
* @param username Username of the client
* @param password Password of the client
* @param willMessage Defines the Application Message that is to be published
*/
public ConnectPayload(
String userId,
String willTopic,
String username,
String password,
byte[] willMessage){
this.userId = userId;
this.willTopic = willTopic;
this.username = username;
this.password = password;
this.willMessage = willMessage;
}
/**
* @return String
*/
public String getUserId() {
return userId;
}
/**
* @return String
*/
public String getWillTopic() {
return willTopic;
}
/**
* @return String
*/
public String getUsername() {
return username;
}
/**
* @return String
*/
public String getPassword() {
return password;
}
/**
* @return byte[]
*/
public byte[] getWillMessage() {
return willMessage;
}
/**
* @return String
*/
@Override
public String toString() {
return "ConnectPayload: {" +
" userId='" + getUserId() + "'" +
", willTopic='" + getWillTopic() + "'" +
", username='" + getUsername() + "'" +
", password='" + getPassword() + "'" +
", willMessage='" + getWillMessage() + "'" +
"}";
}
}