Remove deadlock, make endpoint run in main goroutine.

The for{} doesn't allow for yielding back to the Go runtime scheduler, so it deadlocks. Removing the for{} without making other changes causes main() to fall through and exit (since endpoint() was being started in another goroutine). The other changes makes it so that is run in the main thread/goroutine instead.
Merge pull request #1 from colemickens/master

Remove deadlock, make endpoint run in main goroutine.