Package com.esotericsoftware.kryonet

Examples of com.esotericsoftware.kryonet.Server


import com.esotericsoftware.kryonet.Listener;
import com.esotericsoftware.kryonet.Server;

public class DeltaTest extends KryoNetTestCase {
  public void testDelta () throws IOException {
    final Server server = new Server();
    register(server.getKryo());

    final SomeData data = new SomeData();
    data.text = "some text here aaaaaaabbbbbccccc";
    data.stuff = new short[] {1, 2, 3, 4, 5, 6, 7, 8};

    startEndPoint(server);
    server.bind(tcpPort, udpPort);
    server.addListener(new Listener() {
      public void connected (Connection connection) {
        data.stuff[3] = 4;
        server.sendToAllTCP(data);

        data.stuff[3] = 123;
        connection.sendTCP(data);

        data.stuff[3] = 125;
View Full Code Here


import com.esotericsoftware.kryonet.Listener;
import com.esotericsoftware.kryonet.Server;

public class DeflateTest extends KryoNetTestCase {
  public void testDeflate () throws IOException {
    final Server server = new Server();
    register(server.getKryo());

    final SomeData data = new SomeData();
    data.text = "some text here aaaaaaaaaabbbbbbbbbbbcccccccccc";
    data.stuff = new short[] {1, 2, 3, 4, 5, 6, 7, 8};

    final ArrayList a = new ArrayList();
    a.add(12);
    a.add(null);
    a.add(34);

    startEndPoint(server);
    server.bind(tcpPort, udpPort);
    server.addListener(new Listener() {
      public void connected (Connection connection) {
        server.sendToAllTCP(data);
        connection.sendTCP(data);
        connection.sendTCP(a);
      }
    });
View Full Code Here

import com.esotericsoftware.kryonet.Listener;
import com.esotericsoftware.kryonet.Server;

public class RmiTest extends KryoNetTestCase {
  public void testRMI () throws IOException {
    Server server = new Server();
    register(server.getKryo());
    startEndPoint(server);
    server.bind(tcpPort);

    final ObjectSpace serverObjectSpace = new ObjectSpace();
    final TestObjectImpl serverTestObject = new TestObjectImpl(4321);
    serverObjectSpace.register((short)42, serverTestObject);

    server.addListener(new Listener() {
      public void connected (final Connection connection) {
        serverObjectSpace.addConnection(connection);
        runTest(connection, 12, 1234);
      }
View Full Code Here

public class PositionServer {
  Server server;
  HashSet<Character> loggedIn = new HashSet();

  public PositionServer () throws IOException {
    server = new Server() {
      protected Connection newConnection () {
        // By providing our own connection implementation, we can store per
        // connection state without a connection ID to state look up.
        return new CharacterConnection();
      }
View Full Code Here

  private ArrayList<SimpleUnit> allTempUnits = new ArrayList<SimpleUnit>(); //TODO: This will later be removed, this is used to test the server
  private ArrayList<SimpleUnit> allUnits = new ArrayList<SimpleUnit>(); //Holds all units tracked server side

    public WarTugServer () throws IOException {
      //Set-up Server here
      server = new Server() {
            protected Connection newConnection () {
                    // By providing our own connection implementation, we can store per
                    // connection state without a connection ID to state look up.
                    return new WarTugConnection();
            }
View Full Code Here

  private Player[] players = new Player[2];
  private int currWave = 0;

    public WarTugServer () throws IOException {
      //Set-up Server here
      server = new Server() {
            protected Connection newConnection () {
                    // By providing our own connection implementation, we can store per
                    // connection state without a connection ID to state look up.
                    return new WarTugConnection();
            }
View Full Code Here

public class ChatServer {
        Server server;

        public ChatServer () throws IOException {
                server = new Server() {
                        protected Connection newConnection () {
                                // By providing our own connection implementation, we can store per
                                // connection state without a connection ID to state look up.
                                return new ChatConnection();
                        }
View Full Code Here

    }
  }

  @Override
  public void startup() {
    server = new Server();
    for (Class<?> clazz : KryoUtil.getInstance()
        .getClassesForRegistration()) {
      server.getKryo().register(clazz);
    }
View Full Code Here

    sendingObjets = new HashMap<>();

    pendingRequest = new HashMap<>();

    bufferSize = DocuManager.BYTE_TO_1MO * 10;
    server = new Server(bufferSize, bufferSize);
    server.start();
    server.bind(portTcp, portTcp + 1);

    NetworkKryoInit init = new NetworkKryoInit();
    init.registerKryo(server.getKryo());
View Full Code Here

    sendingObjets = new HashMap<>();

    pendingRequest = new HashMap<>();

    bufferSize = DocuManager.BYTE_TO_1MO * 10;
    server = new Server(bufferSize, bufferSize);
    server.start();
    server.bind(portTcp, portTcp + 1);

    NetworkKryoInit init = new NetworkKryoInit();
    init.registerKryo(server.getKryo());
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryonet.Server

Copyright © 2015 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.