コード例 #1
0
ファイル: SslHandler.java プロジェクト: njutony1991/netty
  private void closeOutboundAndChannel(
      final ChannelHandlerContext ctx, final ChannelPromise promise, boolean disconnect)
      throws Exception {
    if (!ctx.channel().isActive()) {
      if (disconnect) {
        ctx.disconnect(promise);
      } else {
        ctx.close(promise);
      }
      return;
    }

    engine.closeOutbound();

    ChannelPromise closeNotifyFuture = ctx.newPromise();
    write(ctx, Unpooled.EMPTY_BUFFER, closeNotifyFuture);
    flush(ctx);
    safeClose(ctx, closeNotifyFuture, promise);
  }