i think I found out what causes the 'end of stream' error
pinging the server (clicking Multiplayer causes it to see if the server is up) makes the server think you're trying to connect or something
so when you actually connect it thinks you're spamming requests so it doesn't let you in
this can be fixed by quickly opening the multiplayer menu again before it decides to refresh and then waiting a few seconds