|
|
|
@ -18,7 +18,7 @@ package org.springframework.bootstrap.context.embedded; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.FileWriter; |
|
|
|
import java.io.FileWriter; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.net.ConnectException; |
|
|
|
import java.net.SocketException; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URISyntaxException; |
|
|
|
import java.net.URISyntaxException; |
|
|
|
import java.nio.charset.Charset; |
|
|
|
import java.nio.charset.Charset; |
|
|
|
@ -56,6 +56,7 @@ import static org.mockito.Mockito.mock; |
|
|
|
* Base for testing classes that extends {@link AbstractEmbeddedServletContainerFactory}. |
|
|
|
* Base for testing classes that extends {@link AbstractEmbeddedServletContainerFactory}. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Phillip Webb |
|
|
|
* @author Phillip Webb |
|
|
|
|
|
|
|
* @author Greg Turnquist |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract class AbstractEmbeddedServletContainerFactoryTests { |
|
|
|
public abstract class AbstractEmbeddedServletContainerFactoryTests { |
|
|
|
|
|
|
|
|
|
|
|
@ -91,8 +92,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { |
|
|
|
factory.setPort(0); |
|
|
|
factory.setPort(0); |
|
|
|
this.container = factory |
|
|
|
this.container = factory |
|
|
|
.getEmbeddedServletContainer(exampleServletRegistration()); |
|
|
|
.getEmbeddedServletContainer(exampleServletRegistration()); |
|
|
|
this.thrown.expect(ConnectException.class); |
|
|
|
this.thrown.expect(SocketException.class); |
|
|
|
this.thrown.expectMessage("Connection refused"); |
|
|
|
|
|
|
|
getResponse("http://localhost:8080/hello"); |
|
|
|
getResponse("http://localhost:8080/hello"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -102,7 +102,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { |
|
|
|
this.container = factory |
|
|
|
this.container = factory |
|
|
|
.getEmbeddedServletContainer(exampleServletRegistration()); |
|
|
|
.getEmbeddedServletContainer(exampleServletRegistration()); |
|
|
|
this.container.stop(); |
|
|
|
this.container.stop(); |
|
|
|
this.thrown.expect(ConnectException.class); |
|
|
|
this.thrown.expect(SocketException.class); |
|
|
|
getResponse("http://localhost:8080/hello"); |
|
|
|
getResponse("http://localhost:8080/hello"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|