Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
0e7824ce
Commit
0e7824ce
authored
Jun 28, 2019
by
Johnny Lim
Committed by
Andy Wilkinson
Jun 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish TomcatReactiveWebServerFactoryTests
See gh-17336
parent
e1394d4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
TomcatReactiveWebServerFactoryTests.java
.../embedded/tomcat/TomcatReactiveWebServerFactoryTests.java
+9
-5
No files found.
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java
View file @
0e7824ce
...
...
@@ -40,7 +40,6 @@ import org.mockito.InOrder;
import
org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory
;
import
org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactoryTests
;
import
org.springframework.boot.web.server.PortInUseException
;
import
org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests
;
import
org.springframework.http.server.reactive.HttpHandler
;
import
org.springframework.util.SocketUtils
;
...
...
@@ -217,7 +216,7 @@ class TomcatReactiveWebServerFactoryTests extends AbstractReactiveWebServerFacto
}
@Test
protected
void
portClashOfPrimaryConnectorResultsInPortInUseException
()
throws
IOException
{
void
portClashOfPrimaryConnectorResultsInPortInUseException
()
throws
IOException
{
doWithBlockedPort
((
port
)
->
{
assertThatExceptionOfType
(
RuntimeException
.
class
).
isThrownBy
(()
->
{
AbstractReactiveWebServerFactory
factory
=
getFactory
();
...
...
@@ -228,8 +227,7 @@ class TomcatReactiveWebServerFactoryTests extends AbstractReactiveWebServerFacto
});
}
protected
final
void
doWithBlockedPort
(
AbstractServletWebServerFactoryTests
.
BlockedPortAction
action
)
throws
IOException
{
private
void
doWithBlockedPort
(
BlockedPortAction
action
)
throws
IOException
{
int
port
=
SocketUtils
.
findAvailableTcpPort
(
40000
);
ServerSocket
serverSocket
=
new
ServerSocket
();
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
...
...
@@ -248,9 +246,15 @@ class TomcatReactiveWebServerFactoryTests extends AbstractReactiveWebServerFacto
}
}
pr
otected
void
handleExceptionCausedByBlockedPortOnPrimaryConnector
(
RuntimeException
ex
,
int
blockedPort
)
{
pr
ivate
void
handleExceptionCausedByBlockedPortOnPrimaryConnector
(
RuntimeException
ex
,
int
blockedPort
)
{
assertThat
(
ex
).
isInstanceOf
(
PortInUseException
.
class
);
assertThat
(((
PortInUseException
)
ex
).
getPort
()).
isEqualTo
(
blockedPort
);
}
public
interface
BlockedPortAction
{
void
run
(
int
port
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment