Fix socket handler in adapter