Skip to content

Commit 71dd607

Browse files
committed
Merge branch '2.5.x' into 2.6.x
Closes gh-30043
2 parents 0ca64d3 + 34e436e commit 71dd607

File tree

1 file changed

+13
-2
lines changed
  • spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client

1 file changed

+13
-2
lines changed

spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/tunnel/client/TunnelClientTests.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
2020
import java.io.Closeable;
2121
import java.io.IOException;
2222
import java.net.InetSocketAddress;
23+
import java.net.SocketException;
2324
import java.nio.ByteBuffer;
2425
import java.nio.channels.Channels;
2526
import java.nio.channels.SocketChannel;
@@ -91,7 +92,17 @@ void stopTriggersTunnelClose() throws Exception {
9192
assertThat(this.tunnelConnection.isOpen()).isTrue();
9293
client.stop();
9394
assertThat(this.tunnelConnection.isOpen()).isFalse();
94-
assertThat(channel.read(ByteBuffer.allocate(1))).isEqualTo(-1);
95+
assertThat(readWithPossibleFailure(channel)).satisfiesAnyOf((result) -> assertThat(result).isEqualTo(-1),
96+
(result) -> assertThat(result).isInstanceOf(SocketException.class));
97+
}
98+
99+
private Object readWithPossibleFailure(SocketChannel channel) {
100+
try {
101+
return channel.read(ByteBuffer.allocate(1));
102+
}
103+
catch (Exception ex) {
104+
return ex;
105+
}
95106
}
96107

97108
@Test

0 commit comments

Comments
 (0)