public Writer newConnectionWriter(Writer newWriter) {
   ((ObservableWriter) writer).removeWriterListener(writerListener);
   ObservableWriter debugWriter = new ObservableWriter(newWriter);
   debugWriter.addWriterListener(writerListener);
   writer = debugWriter;
   return writer;
 }
 /** Stops debugging the connection. Removes any listener on the connection. */
 void cancel() {
   connection.removeConnectionListener(connListener);
   connection.removePacketListener(packetReaderListener);
   connection.removePacketSendingListener(packetWriterListener);
   ((ObservableReader) reader).removeReaderListener(readerListener);
   ((ObservableWriter) writer).removeWriterListener(writerListener);
   messagesTable = null;
 }