use of net.glowstone.net.query.QueryServer in project Glowstone by GlowstoneMC.
the class GlowServer method bind.
private void bind() {
if (Epoll.isAvailable()) {
logger.info("Native epoll transport is enabled.");
}
CountDownLatch latch = new CountDownLatch(3);
networkServer = new GameServer(this, latch);
networkServer.bind(getBindAddress(Key.SERVER_PORT));
if (config.getBoolean(Key.QUERY_ENABLED)) {
queryServer = new QueryServer(this, latch, config.getBoolean(Key.QUERY_PLUGINS));
queryServer.bind(getBindAddress(Key.QUERY_PORT));
} else {
latch.countDown();
}
if (config.getBoolean(Key.RCON_ENABLED)) {
rconServer = new RconServer(this, latch, config.getString(Key.RCON_PASSWORD));
rconServer.bind(getBindAddress(Key.RCON_PORT));
} else {
latch.countDown();
}
try {
latch.await();
} catch (InterruptedException e) {
logger.log(Level.SEVERE, "Bind interrupted! ", e);
System.exit(1);
}
}
use of net.glowstone.net.query.QueryServer in project Glowstone by GlowstoneMC.
the class QueryTest method setup.
@Before
public void setup() throws Exception {
glowServer = mock(GlowServer.class);
CountDownLatch latch = new CountDownLatch(1);
this.queryPlugins = true;
server = new QueryServer(glowServer, latch, queryPlugins);
random = mock(ThreadLocalRandom.class);
PowerMockito.mockStatic(ThreadLocalRandom.class);
when(ThreadLocalRandom.current()).thenReturn(random);
address = InetSocketAddress.createUnresolved("somehost", 12345);
}
Aggregations