org.apache.mina.util.AvailablePortFinder Java Examples
The following examples show how to use
org.apache.mina.util.AvailablePortFinder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApacheKDCServer.java From carbon-identity with Apache License 2.0 | 5 votes |
private int getServerPort(KdcConfiguration configuration) { int port = configuration.getKdcCommunicationPort(); if (port == -1) { port = AvailablePortFinder.getNextAvailable(START_PORT); } return port; }
Example #2
Source File: KDCServerAnnotationProcessor.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private static Transport createTransport( CreateTransport transportBuilder, int startPort ) { String protocol = transportBuilder.protocol(); int port = transportBuilder.port(); int nbThreads = transportBuilder.nbThreads(); int backlog = transportBuilder.backlog(); String address = transportBuilder.address(); if ( port == -1 ) { port = AvailablePortFinder.getNextAvailable( startPort ); startPort = port + 1; } if ( protocol.equalsIgnoreCase( "TCP" ) ) { Transport tcp = new TcpTransport( address, port, nbThreads, backlog ); return tcp; } else if ( protocol.equalsIgnoreCase( "UDP" ) ) { UdpTransport udp = new UdpTransport( address, port ); return udp; } else { throw new IllegalArgumentException( I18n.err( I18n.ERR_689, protocol ) ); } }