connection closing and random port selection