rearrange peer/socket/handshake.