fix socket.end bug

Change-Id: Iac84baeef7b9b7cabcd23465db21cdf012c27532