@Override
 public ListenableFuture<Void> send(Message<byte[]> message) {
   updateLastWriteTime();
   SettableListenableFuture<Void> future = new SettableListenableFuture<Void>();
   try {
     this.session.sendMessage(this.codec.encode(message, this.session.getClass()));
     future.set(null);
   } catch (Throwable ex) {
     future.setException(ex);
   } finally {
     updateLastWriteTime();
   }
   return future;
 }
 public void onFailure(Throwable failure) {
   IoUtils.safeClose(this.connection);
   if (connectFuture.setException(failure)) {
     return;
   }
   if (this.session.isDisconnected()) {
     this.session.afterTransportClosed(null);
   } else {
     this.session.handleTransportError(failure);
     this.session.afterTransportClosed(new CloseStatus(1006, failure.getMessage()));
   }
 }