Check out example codes for "bukkit java connect player to another server in bungeecord". It will help you in understanding the concepts better.

Code Example 1

//onEnable in Main class
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");

//When you want to connect the player
//"server" is the server name the player should connect to
//the variable "player" is the player you want to connect
ByteArrayDataOutput out = ByteStreams.newDataOutput();
player.sendPluginMessage(main, "BungeeCord", out.toByteArray());

Learn ReactJs, React Native from