use of net.glowstone.net.protocol.ProtocolProvider in project Glowstone by GlowstoneMC.
the class GlowServer method bind.
private void bind() {
if (Networking.EPOLL_AVAILABLE) {
ConsoleMessages.Info.NativeTransport.EPOLL.log();
} else if (Networking.KQUEUE_AVAILABLE) {
ConsoleMessages.Info.NativeTransport.KQUEUE.log();
}
CountDownLatch latch = new CountDownLatch(3);
ProtocolProvider protocolProvider = new ProtocolProvider(config);
networkServer = new GameServer(this, protocolProvider, latch);
networkServer.bind(getBindAddress(Key.SERVER_PORT));
if (config.getBoolean(Key.QUERY_ENABLED)) {
queryServer = new QueryServer(this, protocolProvider, 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, protocolProvider, latch, config.getString(Key.RCON_PASSWORD));
rconServer.bind(getBindAddress(Key.RCON_PORT));
} else {
latch.countDown();
}
try {
latch.await();
} catch (InterruptedException e) {
ConsoleMessages.Error.Rcon.BIND_INTERRUPTED.log(e);
System.exit(1);
}
}
use of net.glowstone.net.protocol.ProtocolProvider in project Glowstone by GlowstoneMC.
the class HandshakeProtocolTest method createHandshakeProtocol.
private static HandshakeProtocol createHandshakeProtocol() {
ServerConfig serverConfig = mock(ServerConfig.class);
when(serverConfig.getMapList(ServerConfig.Key.DNS_OVERRIDES)).thenReturn(Collections.emptyList());
ProtocolProvider protocolProvider = new ProtocolProvider(serverConfig);
return protocolProvider.handshake;
}
use of net.glowstone.net.protocol.ProtocolProvider in project Glowstone by GlowstoneMC.
the class GameServerTest method setUp.
@BeforeEach
public void setUp() throws IllegalAccessException {
GlowServer.logger.addHandler(handler);
glowServer = mock(GlowServer.class, Answers.RETURNS_SMART_NULLS);
CountDownLatch latch = new CountDownLatch(1);
ProtocolProvider protocolProvider = new ProtocolProvider(mock(HandshakeProtocol.class), mock(StatusProtocol.class), mock(LoginProtocol.class), mock(PlayProtocol.class));
gameServer = new GameServer(glowServer, protocolProvider, latch);
latch.countDown();
}
use of net.glowstone.net.protocol.ProtocolProvider 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);
ProtocolProvider protocolProvider = new ProtocolProvider(mock(HandshakeProtocol.class), mock(StatusProtocol.class), mock(LoginProtocol.class), mock(PlayProtocol.class));
this.queryPlugins = true;
server = new QueryServer(glowServer, protocolProvider, latch, queryPlugins);
random = mock(ThreadLocalRandom.class);
PowerMockito.mockStatic(ThreadLocalRandom.class);
when(ThreadLocalRandom.current()).thenReturn(random);
address = InetSocketAddress.createUnresolved("somehost", 12345);
}
use of net.glowstone.net.protocol.ProtocolProvider in project Glowstone by GlowstoneMC.
the class LoginProtocolTest method createLoginProtocol.
private static LoginProtocol createLoginProtocol() {
ServerConfig serverConfig = mock(ServerConfig.class);
when(serverConfig.getMapList(ServerConfig.Key.DNS_OVERRIDES)).thenReturn(Collections.emptyList());
ProtocolProvider protocolProvider = new ProtocolProvider(serverConfig);
return protocolProvider.login;
}
Aggregations