Fix IllegalStateException triggered by a successful connection attempt

- Fixes #1467
- Provide more information about the tasks and promises on exception for easier debugging
Remove cruft
Make sure PlatformDependent.maxDirectMemory() works on Android

- Fixes #1451