Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

Support multiple clients #1

Open
Aaron1011 opened this issue Jun 20, 2018 · 0 comments
Open

Support multiple clients #1

Aaron1011 opened this issue Jun 20, 2018 · 0 comments

Comments

@Aaron1011
Copy link
Contributor

While a singleplayer environment is usually sufficient for testing purposes, it can sometimes be useful to control multiple clients from a test class. For example, testing SpongeAPI's Keys.VANISH on a player would require at least two clients to be connected.

There are two different ways that we could go about accomplishing this:

  • Run each client in a separate 'base' classloader. Normally, LaunchClassLoader is created from a single base AppClassLoader. In this scenario, each client instance would have its own base (non-LaunchClassLoader) classloader. Each base classloader would be responsible for creating its own LaunchClassLoader.
  • Run each client as a separate process. In this scenario, there would be no direct communication between the root process's main thread (which runs the JUnit test cases), and the individual client instances. Instead, all communication would continue to occur through the pre-existing custom packet system.

The first approach might make debugging slightly easier - there's only one JVM to attach breakpoints to. On the other hand, the classloader setup could very quickly spiral out of control - any leakage could be a nightmare to debug when there are four active threads (JUnit runner + server + 2 clients) at any given point in time.

The second approach might simplify the implementation - each process can simply be launched with the proper command-line arguments specifying the server to connect to. Once connected, our internal custom packet control system will continue to work as normal. Ideally, there would be no observable difference between the in-process singleplayer client, and the separate-process clients connecting to the LAN world.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant