use of io.zeebe.transport.ClientTransport in project zeebe by zeebe-io.
the class ZeebeClientTest method shouldEstablishNewConnectionsAfterDisconnect.
@Test
public void shouldEstablishNewConnectionsAfterDisconnect() {
// given
final ClientTransport clientTransport = client.getTransport();
// ensuring an open connection
client.requestTopology().execute();
final LoggingChannelListener channelListener = new LoggingChannelListener();
clientTransport.registerChannelListener(channelListener).join();
// when
broker.closeTransport();
System.out.println("Broker transport closed");
broker.bindTransport();
System.out.println("Broker transport bound");
// then
final TopicSubscription newSubscription = openSubscription();
assertThat(newSubscription.isOpen()).isTrue();
// listener invocation is asynchronous
waitUntil(() -> channelListener.connectionState.contains(ConnectionState.CONNECTED));
assertThat(channelListener.connectionState).last().isSameAs(ConnectionState.CONNECTED);
}
Aggregations