This happens only on servers, not LAN worlds!
*What I expected to happen was:
I would instantly take damage from the lava
*What actually happened was:
I was immune to the lava, then I swam out, and was set on fire and died, but it still said "chilbree tried to swim in lava" instead of "chilbree burned to death"
*Steps to reproduce:
1. Swim in lava
2. Disconnect
3. Reconnect and you will be immune to the lava.
4. Swim out of the lava and you will burn to death.
Sounds like it's just server lag.