Fix socket bug in TcpConnection.