Skip to content

Commit b5c9afc

Browse files
committed
Merge branch '2.1.x'
2 parents c12bb77 + 08ce814 commit b5c9afc

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/UndertowWebServerFactoryCustomizer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 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.
@@ -37,6 +37,7 @@
3737
* @author Yulin Qin
3838
* @author Stephane Nicoll
3939
* @author Phillip Webb
40+
* @author Arstiom Yudovin
4041
* @since 2.0.0
4142
*/
4243
public class UndertowWebServerFactoryCustomizer implements
@@ -106,7 +107,7 @@ private boolean isPositive(Number value) {
106107

107108
private void customizeConnectionTimeout(ConfigurableUndertowWebServerFactory factory,
108109
Duration connectionTimeout) {
109-
factory.addBuilderCustomizers((builder) -> builder.setSocketOption(
110+
factory.addBuilderCustomizers((builder) -> builder.setServerOption(
110111
UndertowOptions.NO_REQUEST_TIMEOUT, (int) connectionTimeout.toMillis()));
111112
}
112113

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/UndertowWebServerFactoryCustomizerTests.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 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.
@@ -47,6 +47,7 @@
4747
*
4848
* @author Brian Clozel
4949
* @author Phillip Webb
50+
* @author Artsiom Yudovin
5051
*/
5152
public class UndertowWebServerFactoryCustomizerTests {
5253

@@ -143,6 +144,18 @@ public void customMaxHttpHeaderSizeIgnoredIfZero() {
143144
assertThat(map.contains(UndertowOptions.MAX_HEADER_SIZE)).isFalse();
144145
}
145146

147+
@Test
148+
public void customConnectionTimeout() {
149+
bind("server.connection-timeout=100");
150+
Builder builder = Undertow.builder();
151+
ConfigurableUndertowWebServerFactory factory = mockFactory(builder);
152+
this.customizer.customize(factory);
153+
OptionMap map = ((OptionMap.Builder) ReflectionTestUtils.getField(builder,
154+
"serverOptions")).getMap();
155+
assertThat(map.contains(UndertowOptions.NO_REQUEST_TIMEOUT)).isTrue();
156+
assertThat(map.get(UndertowOptions.NO_REQUEST_TIMEOUT)).isEqualTo(100);
157+
}
158+
146159
private ConfigurableUndertowWebServerFactory mockFactory(Builder builder) {
147160
ConfigurableUndertowWebServerFactory factory = mock(
148161
ConfigurableUndertowWebServerFactory.class);

0 commit comments

Comments
 (0)