本文整理汇总了Java中org.apache.mina.util.AvailablePortFinder类的典型用法代码示例。如果您正苦于以下问题:Java AvailablePortFinder类的具体用法?Java AvailablePortFinder怎么用?Java AvailablePortFinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AvailablePortFinder类属于org.apache.mina.util包,在下文中一共展示了AvailablePortFinder类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startLdapServer
import org.apache.mina.util.AvailablePortFinder; //导入依赖的package包/类
private ApacheDS startLdapServer() throws Exception {
Preconditions.checkState(directoryService.isStarted());
Preconditions.checkState(!ldapServer.isStarted());
int port = AvailablePortFinder.getNextAvailable(1024);
ldapServer.setTransports(new TcpTransport(port));
ldapServer.setDirectoryService(directoryService);
// Setup SASL mechanisms
Map<String, MechanismHandler> mechanismHandlerMap = Maps.newHashMap();
mechanismHandlerMap.put(SupportedSaslMechanisms.PLAIN, new PlainMechanismHandler());
mechanismHandlerMap.put(SupportedSaslMechanisms.CRAM_MD5, new CramMd5MechanismHandler());
mechanismHandlerMap.put(SupportedSaslMechanisms.DIGEST_MD5, new DigestMd5MechanismHandler());
mechanismHandlerMap.put(SupportedSaslMechanisms.GSSAPI, new GssapiMechanismHandler());
ldapServer.setSaslMechanismHandlers(mechanismHandlerMap);
ldapServer.setSaslHost("localhost");
ldapServer.setSaslRealms(Collections.singletonList(realm));
// TODO ldapServer.setSaslPrincipal();
// The base DN containing users that can be SASL authenticated.
ldapServer.setSearchBaseDn(baseDn);
ldapServer.start();
return this;
}
开发者ID:SonarQubeCommunity,项目名称:sonar-activedirectory,代码行数:27,代码来源:ApacheDS.java
示例2: setUp
import org.apache.mina.util.AvailablePortFinder; //导入依赖的package包/类
/**
* Get's the initial context factory for the provider's ou=system context root.
*
* @throws Exception
* if there is a failure of any kind
*/
protected void setUp() throws Exception {
setStart(getStart() + 1);
setDirectoryService(new DefaultDirectoryService());
getDirectoryService().setShutdownHookEnabled(false);
setPort(AvailablePortFinder.getNextAvailable(1024));
setLdapServer(new LdapServer());
getLdapServer().setTransports(new TcpTransport(getPort()));
getLdapServer().setDirectoryService(getDirectoryService());
setupSaslMechanisms(getLdapServer());
getDirectoryService().setWorkingDirectory(
new File("target" + File.separator + "server-work"));
doDelete(getDirectoryService().getWorkingDirectory());
configureDirectoryService();
getDirectoryService().startup();
configureLdapServer();
// TODO shouldn't this be before calling configureLdapServer() ???
getLdapServer().addExtendedOperationHandler(new StartTlsHandler());
getLdapServer().addExtendedOperationHandler(new StoredProcedureExtendedOperationHandler());
getLdapServer().start();
setContexts(ServerDNConstants.ADMIN_SYSTEM_DN, "secret");
}
开发者ID:Communote,项目名称:communote-server,代码行数:32,代码来源:AbstractApacheDSServer.java
示例3: setUp
import org.apache.mina.util.AvailablePortFinder; //导入依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
configuration = new MutableServerStartupConfiguration();
configuration.setWorkingDirectory(new File(workingDir));
cleanWorkingDir(configuration.getWorkingDirectory());
port = AvailablePortFinder.getNextAvailable(1024);
configuration.setLdapPort(port);
// configuration.setShutdownHookEnabled(false);
serverEnv = new Hashtable<String, Object>(configuration
.toJndiEnvironment());
initialAuth();
serverEnv.put(Context.INITIAL_CONTEXT_FACTORY,
ServerContextFactory.class.getName());
serverEnv.put(Context.PROVIDER_URL, "");
rootDSE = new InitialLdapContext(serverEnv, null);
}
开发者ID:freeVM,项目名称:freeVM,代码行数:21,代码来源:Support_LdapTest.java
示例4: startES
import org.apache.mina.util.AvailablePortFinder; //导入依赖的package包/类
public final void startES(final Settings settings) throws Exception {
FileUtils.deleteDirectory(new File("data"));
Set<Integer> ports = null;
int offset = 0;
final int windowsSize = 12;
do {
ports = AvailablePortFinder.getAvailablePorts(AvailablePortFinder.MAX_PORT_NUMBER - offset - windowsSize,
AvailablePortFinder.MAX_PORT_NUMBER - offset);
offset += windowsSize;
} while (ports.size() < 7);
final Iterator<Integer> portIt = ports.iterator();
elasticsearchHttpPort1 = portIt.next();
elasticsearchHttpPort2 = portIt.next();
elasticsearchHttpPort3 = portIt.next();
elasticsearchNodePort1 = portIt.next();
elasticsearchNodePort2 = portIt.next();
elasticsearchNodePort3 = portIt.next();
esNode1 = NodeWithArmor(getDefaultSettingsBuilder(1, elasticsearchNodePort1, elasticsearchHttpPort1, true, true).put(
settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build());
esNode2 = NodeWithArmor(
getDefaultSettingsBuilder(2, elasticsearchNodePort2, elasticsearchHttpPort2, true, true).put(
settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build());
esNode3 = NodeWithArmor(
getDefaultSettingsBuilder(3, elasticsearchNodePort3, elasticsearchHttpPort3, true, false).put(
settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build());
esNode1.start();
esNode2.start();
esNode3.start();
waitForGreenClusterState(esNode1.client());
}
开发者ID:petalmd,项目名称:armor,代码行数:39,代码来源:AbstractUnitTest.java
示例5: getServerPort
import org.apache.mina.util.AvailablePortFinder; //导入依赖的package包/类
private int getServerPort(KdcConfiguration configuration) {
int port = configuration.getKdcCommunicationPort();
if (port == -1) {
port = AvailablePortFinder.getNextAvailable(START_PORT);
}
return port;
}
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:10,代码来源:ApacheKDCServer.java
示例6: createTransport
import org.apache.mina.util.AvailablePortFinder; //导入依赖的package包/类
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 ) );
}
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:30,代码来源:KDCServerAnnotationProcessor.java
示例7: setUp
import org.apache.mina.util.AvailablePortFinder; //导入依赖的package包/类
protected void setUp() throws Exception
{
super.setUp();
port = AvailablePortFinder.getNextAvailable(12000);
}
开发者ID:wso2,项目名称:andes,代码行数:7,代码来源:ConnectionTest.java
示例8: findFreePort
import org.apache.mina.util.AvailablePortFinder; //导入依赖的package包/类
public int findFreePort()
{
return AvailablePortFinder.getNextAvailable(10000);
}
开发者ID:wso2,项目名称:andes,代码行数:5,代码来源:QpidTestCase.java
注:本文中的org.apache.mina.util.AvailablePortFinder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论