Cherry-picked 4e3388964af9697496d2c5e000bb8559dfba87ad from
astrand/websockify:

    Prepare for fixing https://github.com/kanaka/websockify/issues/71:
    Move around functions and methods, so that connection-related and
    server-related stuff are close together.

    This patch just moves things around - it does not change anything at
    all. This can be verified with:

    git diff websocket.py | grep ^- | cut -c 2- | sort > removed
    git diff websocket.py | grep ^+ | cut -c 2- | sort > added
    diff -u removed added
Merge remote branch 'upstream/master'

Conflicts:
	websockify/websocket.py
Minor whitespace and layout tweaks, to reduce diff against
upstream/master.