Server and Client on one instance of a game

Of course you can! Just connect to localhost under your game server’s port (for example, if the server’s port is 1234 you connect to the IP address localhost:1234. To do so, you use the Client class, with the constructor new Client(this, "localhost", 1234)).