@Test
void shouldThrowWhenRediscoveryReturnsNoSuitableServers()
{

    ConnectionPool connectionPool = newConnectionPoolMock();
    RoutingTable routingTable = mock( RoutingTable.class );
    when( routingTable.readers() ).thenReturn( new AddressSet() );
    when( routingTable.writers() ).thenReturn( new AddressSet() );
    LoadBalancer loadBalancer = newLoadBalancer( connectionPool, routingTable );
    SessionExpiredException error1 = assertThrows( SessionExpiredException.class, () -> await( loadBalancer.acquireConnection( contextWithMode( READ ) ) ) );
    assertThat( error1.getMessage(), startsWith( "Failed to obtain connection towards READ server" ) );
    SessionExpiredException error2 = assertThrows( SessionExpiredException.class, () -> await( loadBalancer.acquireConnection( contextWithMode( WRITE ) ) ) );
    assertThat( error2.getMessage(), startsWith( "Failed to obtain connection towards WRITE server" ) );
}