Switch from using Socket to SocketChannel

I also store the latest used alias in SharedPreferences so that it won't
be lost when the application is closed.