|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.xenqtt.SimpleBroker
net.sf.xenqtt.mockbroker.MockBroker
public final class MockBroker
Mock MQTT broker used to test MQTT clients and applications. If debug level logging is enabled all broker events will be logged.
| Field Summary |
|---|
| Fields inherited from class net.sf.xenqtt.SimpleBroker |
|---|
manager |
| Constructor Summary | |
|---|---|
MockBroker()
Creates a broker with the following config: no MockBrokerHandler
15 second message resend interval
Any available port. |
|
MockBroker(MockBrokerHandler brokerHandler)
Creates a broker with the specified handler and the following config:
15 second message resend interval
Any available port. |
|
MockBroker(MockBrokerHandler brokerHandler,
long messageResendIntervalSeconds,
int port,
boolean allowAnonymousAccess,
boolean captureBrokerEvents,
int maxInFlightMessages)
Create a new instance of this class. |
|
| Method Summary | |
|---|---|
void |
addCredentials(String userName,
String password)
Adds the specified credentials for authentication by ConnectMessages. |
void |
clearEvents()
Removes all broker events |
List<BrokerEvent> |
getEvents()
|
List<BrokerEvent> |
getEvents(String clientId)
|
void |
init()
Starts the mock broker |
void |
removeEvents(Collection<BrokerEvent> eventsToRemove)
Removes the specified broker events. |
| Methods inherited from class net.sf.xenqtt.SimpleBroker |
|---|
getPort, getURI, init, shutdown |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MockBroker()
MockBrokerHandlerSimpleBroker.getPort() to get the port.
public MockBroker(MockBrokerHandler brokerHandler)
handler and the following config:
SimpleBroker.getPort() to get the port.
public MockBroker(MockBrokerHandler brokerHandler,
long messageResendIntervalSeconds,
int port,
boolean allowAnonymousAccess,
boolean captureBrokerEvents,
int maxInFlightMessages)
brokerHandler - Called when events happen. Can be null if you don't need to do any custom message handling.messageResendIntervalSeconds - Seconds between attempts to resend a message that is MqttMessage.isAckable(). 0 to disable message resends.port - The port for the server to listen on. 0 will choose an arbitrary available port which you can get from SimpleBroker.getPort() after
calling init().allowAnonymousAccess - If true then ConnectMessage with no username/password will be accepted. Otherwise only valid credentials will be accepted.captureBrokerEvents - If true then capture all events within the broker; otherwise, do not capture any eventsmaxInFlightMessages - Maximum number of concurrent publish messages the broker will have in-flight to the client. This is an approximation. The actual maximum
number of in-flight messages may vary slightly.| Method Detail |
|---|
public void init()
public void addCredentials(String userName,
String password)
ConnectMessages. If password is null any existing credentials for the user are
removed.
public List<BrokerEvent> getEvents()
public List<BrokerEvent> getEvents(String clientId)
public void clearEvents()
public void removeEvents(Collection<BrokerEvent> eventsToRemove)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||