[SPARK-2583] ConnectionManager cannot distinguish whether error occurred or not

How about 
```scala
put(if (hasError) 1.asInstanceOf[Byte] else 0.asInstanceOf[Byte])
```