@Override
 public ConnectionState getConnectionState() {
   ConnectionState state;
   if (socket != null) {
     state = ConnectionState.fromInt(socket.getSocketState());
   } else {
     state = ConnectionState.CLOSED;
   }
   return state;
 }