Created
November 16, 2012 20:58
-
-
Save ffbit/4090864 to your computer and use it in GitHub Desktop.
Jetty Connector Port unit test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.eclipse.jetty.server.Connector; | |
| import org.eclipse.jetty.server.Server; | |
| import org.eclipse.jetty.server.nio.SelectChannelConnector; | |
| import org.junit.BeforeClass; | |
| import org.junit.Test; | |
| import org.junit.experimental.categories.Category; | |
| import org.junit.runner.RunWith; | |
| import static org.hamcrest.CoreMatchers.is; | |
| import static org.junit.Assert.assertThat; | |
| public class JettyConnectorTest { | |
| private static Server server = new Server(); | |
| private static Connector connector = new SelectChannelConnector(); | |
| @BeforeClass | |
| public static void setUp() throws Exception { | |
| connector.setPort(0); | |
| server.addConnector(connector); | |
| server.start(); | |
| } | |
| @Test | |
| public void connectorsShouldHaveTheSameLocalPort() throws Exception { | |
| assertThat(connector.getLocalPort(), | |
| is(server.getConnectors()[0].getLocalPort())); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment