Began converting connection code from using sockets and streams to
SocketChannels. Halfway done, so this is broken code