You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 31, 2020. It is now read-only.
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.
The text was updated successfully, but these errors were encountered:
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:
LaunchClassLoader
is created from a single baseAppClassLoader
. In this scenario, each client instance would have its own base (non-LaunchClassLoader) classloader. Each base classloader would be responsible for creating its ownLaunchClassLoader
.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.
The text was updated successfully, but these errors were encountered: