protected void validate(int port) { assertValid(port); }
public ExternalSessionFactory(String host, Port port, Monitor monitor, String shabang) { this(new InetSocketAddress(host, port.getValue()), monitor, shabang); }
public static void assertValid(int port) { Preconditions.checkArgument(isValid(port), "Port should be between 1 and 65535"); }
@Override public void configure(HierarchicalConfiguration config) throws ConfigurationException { if (configuration.isEnabled()) { service.port(configuration.getPort().get().getValue()); configureExceptionHanding(); configureHTTPS(); configureCORS(); configureMetrics(); service.before((request, response) -> response.type(Constants.JSON_CONTENT_TYPE)); configureMDC(); routesList.forEach(routes -> { service.before(routes.getBasePath(), authenticationFilter); service.before(routes.getBasePath() + "/*", authenticationFilter); routes.define(service); }); publicRoutes.forEach(routes -> routes.define(service)); service.awaitInitialization(); port = new Port(service.port()); LOGGER.info("Web admin server started"); } }
public static Port of(int portNumber) { return new Port(portNumber); }
@Test public void generateValidUnprivilegedPortShouldReturnAValidPort() { assertThat(Port.generateValidUnprivilegedPort()) .isBetween(Port.PRIVILEGED_PORT_BOUND, Port.MAX_PORT_VALUE); }
public Port(int value) { validate(value); this.value = value; }
public static Port of(int portNumber) { return new Port(portNumber); }
@Test void generateValidUnprivilegedPortShouldReturnAValidPort() { assertThat(Port.generateValidUnprivilegedPort()) .isBetween(Port.PRIVILEGED_PORT_BOUND, Port.MAX_PORT_VALUE); }
public Port(int value) { validate(value); this.value = value; }
protected void validate(int port) { assertValid(port); }
public static void assertValid(int port) { Preconditions.checkArgument(isValid(port), "Port should be between 1 and 65535"); }
public FixedPortSupplier(int port) { this.port = new Port(port); }
@Test public void shouldStartOnConfiguredPort() throws Exception { int port = Port.generateValidUnprivilegedPort(); testee = JettyHttpServer.create(configurationBuilder.port(port).build()).start(); assertThat(testee.getPort()).isEqualTo(port); }
public Port(int value) { validate(value); this.value = value; }
protected void validate(int port) { assertValid(port); }
public static void assertValid(int port) { Preconditions.checkArgument(isValid(port), "Port should be between 1 and 65535"); }
/** * Starts serving. * @throws IOException when connection fails * @throws IllegalStateException when already started */ public void start() throws IOException { synchronized (queue) { if (socket == null) { socket = ServerSocketChannel.open(); socket.socket().bind(new InetSocketAddress(0)); port = new Port(socket.socket().getLocalPort()); // only going to record a single conversation socket.configureBlocking(false); final Thread socketMonitorThread = new Thread(new SocketMonitor()); socketMonitorThread.start(); } else { throw new IllegalStateException("Already started"); } } }