Added port selection, proxy state, restart proxy