Add STOMP broker relay unit tests

This commit is contained in:
Rossen Stoyanchev
2013-10-23 16:26:28 -04:00
parent bfa6645c7d
commit 4892a27016
3 changed files with 194 additions and 17 deletions

View File

@@ -141,17 +141,6 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
return this.relayPort;
}
/**
* Configure the TCP client to for managing STOMP over TCP connections to the message
* broker. This is an optional property that can be used to replace the default
* implementation used for example for testing purposes.
* <p>
* By default an instance of {@link ReactorNettyTcpClient} is used.
*/
public void setTcpClient(TcpOperations<byte[]> tcpClient) {
this.tcpClient = tcpClient;
}
/**
* Set the interval, in milliseconds, at which the "system" connection will, in the
* absence of any other data being sent, send a heartbeat to the STOMP broker. A value
@@ -250,11 +239,20 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
return this.virtualHost;
}
/**
* Used for unit testing.
*/
void setTcpClient(TcpOperations<byte[]> tcpClient) {
this.tcpClient = tcpClient;
}
@Override
protected void startInternal() {
this.tcpClient = new ReactorNettyTcpClient<byte[]>(this.relayHost, this.relayPort, new StompCodec());
if (this.tcpClient == null) {
this.tcpClient = new ReactorNettyTcpClient<byte[]>(this.relayHost, this.relayPort, new StompCodec());
}
if (logger.isDebugEnabled()) {
logger.debug("Initializing \"system\" TCP connection");