Ejemplo n.º 1
0
 private void disconnectAbnormally(String message) {
   try {
     halt();
     // Disconnect abnormally. The user code should reconnect using the mail client.
     errorStack.push(new Error(completions.poll(), message, wireTrace.list()));
     idler.disconnect();
   } finally {
     disconnected();
   }
 }
Ejemplo n.º 2
0
  private void reset() {
    Preconditions.checkState(
        !isConnected(),
        "Cannot reset while mail client is still connected (call disconnect() first).");

    // Just to be on the safe side.
    if (mailClientHandler != null) {
      mailClientHandler.halt();
      mailClientHandler.disconnected();
    }

    this.mailClientHandler = new MailClientHandler(this, config);
    MailClientPipelineFactory pipelineFactory =
        new MailClientPipelineFactory(mailClientHandler, config);

    this.bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(bossPool, workerPool));
    this.bootstrap.setPipelineFactory(pipelineFactory);

    // Reset state (helps if this is a reconnect).
    this.currentFolder = null;
    this.sequence.set(0L);
    mailClientHandler.idleRequested.set(false);
  }