ONOS-4000 trimming reply from device and minor Netconf classes refactoring

Change-Id: I33a6d5cac8a2523d377c662e3ae362903d9883fb
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
index 7df7849..1ed3f39 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
@@ -161,13 +161,8 @@
                 while (!socketClosed) {
                     int cInt = bufferReader.read();
                     if (cInt == -1) {
-                        socketClosed = true;
-                        log.debug("char {} " + bufferReader.read());
-                        NetconfDeviceOutputEvent event = new NetconfDeviceOutputEvent(
-                                NetconfDeviceOutputEvent.Type.DEVICE_UNREGISTERED,
-                                null, null, Optional.of(-1), netconfDeviceInfo);
-                        netconfDeviceEventListeners.forEach(
-                                listener -> listener.event(event));
+                        log.debug("Netconf device {}  sent error char in session," +
+                                          " will need to be reopend", netconfDeviceInfo);
                     }
                     char c = (char) cInt;
                     state = state.evaluateChar(c);
@@ -175,6 +170,7 @@
                     if (state == NetconfMessageState.END_PATTERN) {
                         String deviceReply = deviceReplyBuilder.toString();
                         if (deviceReply.equals(END_PATTERN)) {
+                            socketClosed = true;
                             NetconfDeviceOutputEvent event = new NetconfDeviceOutputEvent(
                                     NetconfDeviceOutputEvent.Type.DEVICE_UNREGISTERED,
                                     null, null, Optional.of(-1), netconfDeviceInfo);