Corrected socket handling in authentication socket class