當前位置: 首頁>>代碼示例>>Java>>正文


Java ChannelPipeline.remove方法代碼示例

本文整理匯總了Java中io.netty.channel.ChannelPipeline.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java ChannelPipeline.remove方法的具體用法?Java ChannelPipeline.remove怎麽用?Java ChannelPipeline.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.netty.channel.ChannelPipeline的用法示例。


在下文中一共展示了ChannelPipeline.remove方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: switchToBinary

import io.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
private void switchToBinary(ChannelHandlerContext ctx) {
    ChannelPipeline p = ctx.pipeline();
    p.addLast(new DelimiterBasedFrameDecoder(maxFrameLength, Delimiters.lineDelimiter()));
    p.addLast(new StringDecoder(Charset.forName(charset)));
    p.addLast(new NetoJsonToMessageDecoder(opcodeMap));

    NetoMessageToJsonEncoder netoMessageToJsonEncoder = new NetoMessageToJsonEncoder();
    netoMessageToJsonEncoder.setOpcodeMap(opcodeMap);

    p.addLast(netoMessageToJsonEncoder);
    p.addLast(new MessageHandler(redisService));
    p.remove(this);


    // 핸들러를 다시 등록 했으므로 이벤트를 전파
    ctx.fireChannelActive();
}
 
開發者ID:veritasware,項目名稱:neto,代碼行數:18,代碼來源:ProtocolUnificationHandler.java

示例2: encode

import io.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
protected void encode(ChannelHandlerContext ctx, ConnectionResponse msg, ByteBuf out) throws Exception {
	ChannelPipeline pipeline = ctx.pipeline();

	switch (msg.getType()) {
	case HANDSHAKE_CONNECTION:
		pipeline.addAfter("decoder", "handshake.encoder", new HandshakeEncoder());
		pipeline.replace("decoder", "handshake.decoder", new HandshakeDecoder());
		break;
	case LOGIN_CONNECTION:
		out.writeByte(ClientMessage.SUCCESSFUL_CONNECTION.getId());
		pipeline.addAfter("decoder", "login.encoder", new LoginEncoder());
		pipeline.replace("decoder", "login.decoder", new LoginDecoder());
		break;
	}

	pipeline.remove(this);
}
 
開發者ID:jordanabrahambaws,項目名稱:Quavo,代碼行數:19,代碼來源:ConnectionEncoder.java

示例3: handleMessage

import io.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public void handleMessage(ChannelHandlerContext ctx, WorldLoginRequest msg) {
	ClientMessage message = evaluateLogin(msg);
	if (message != ClientMessage.SUCCESSFUL) {
		ctx.write(new WorldLoginResponse(message));
		return;
	}

	Player player = new Player(ctx.channel());
	ctx.write(new WorldLoginResponse(player, message, msg.getIsaacPair()));

	ChannelPipeline pipeline = ctx.pipeline();
	pipeline.remove("login.encoder");

	// this isnt set automatically.
	pipeline.addAfter("world.decoder", "game.encoder", new GamePacketEncoder(msg.getIsaacPair().getEncoderRandom()));
	pipeline.replace("world.decoder", "game.decoder", new GamePacketDecoder(player, msg.getIsaacPair().getDecoderRandom()));

	player.init(msg.getDisplayInformation());
}
 
開發者ID:jordanabrahambaws,項目名稱:Quavo,代碼行數:21,代碼來源:WorldLoginListener.java

示例4: enableSsl

import io.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
private void enableSsl(ChannelHandlerContext ctx) {

        logger.info("Enabled SSL Context");

        ChannelPipeline p = ctx.pipeline();
        p.addLast("ssl", sslCtx.newHandler(ctx.alloc()));
        p.addLast("unification-ssl", new ProtocolUnificationHandler(isUnificationMode, opcodeMap, sslCtx, false, maxFrameLength, charset));
        p.remove(this);
    }
 
開發者ID:veritasware,項目名稱:neto,代碼行數:10,代碼來源:ProtocolUnificationHandler.java

示例5: switchToHttp

import io.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
private void switchToHttp(ChannelHandlerContext ctx) {
    ChannelPipeline p = ctx.pipeline();
    p.addLast(new HttpServerCodec());
    p.addLast(new HttpObjectAggregator(65536));
    p.addLast(new WebSocketServerCompressionHandler());
    p.addLast(new WebSocketServerProtocolHandler(WEBSOCKET_PATH, "ws", true));
    p.addLast(new NetoJsonStringToMapWebSocketDecoder());
    p.addLast(new NetoMessageToWebsocketFrameEncoder());
    p.remove(this);

    // 핸들러를 다시 등록 했으므로 이벤트를 전파
    ctx.fireChannelActive();
}
 
開發者ID:veritasware,項目名稱:neto,代碼行數:14,代碼來源:ProtocolUnificationHandler.java

示例6: removeIfExists

import io.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
/**
 * Removes handlers of the given class types from the pipeline.
 *
 * @param pipeline the pipeline to remove handlers from
 * @param handlers handlers to remove, identified by class
 */
@SafeVarargs
public static void removeIfExists(ChannelPipeline pipeline, Class<? extends ChannelHandler>... handlers) {
    for (Class<? extends ChannelHandler> handler : handlers) {
        if (pipeline.get(handler) != null) {
            pipeline.remove(handler);
        }
    }
}
 
開發者ID:aws,項目名稱:aws-sdk-java-v2,代碼行數:15,代碼來源:ChannelUtils.java

示例7: encode

import io.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
protected void encode(ChannelHandlerContext ctx, LoginResponse msg, ByteBuf out) throws Exception {
	ClientMessage message = msg.getMessage();
	ChannelPipeline pipeline = ctx.pipeline();

	if (message != ClientMessage.SUCCESSFUL) {
		// dont write the id for successful.
		out.writeByte(message.getId());
	} else {
		pipeline.addAfter("login.decoder", "world.encoder", new WorldLoginEncoder());
		pipeline.replace("login.decoder", "world.decoder", new WorldLoginDecoder(msg.getType()));
	}

	pipeline.remove(this);
}
 
開發者ID:jordanabrahambaws,項目名稱:Quavo,代碼行數:16,代碼來源:LoginEncoder.java

示例8: encode

import io.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
protected void encode(ChannelHandlerContext ctx, HandshakeResponse msg, ByteBuf out) throws Exception {
	ChannelPipeline pipeline = ctx.pipeline();
	ClientMessage message = msg.getMessage();

	out.writeByte(message.getId());
	if (message == ClientMessage.SUCCESSFUL_CONNECTION) {
		pipeline.addAfter("handshake.decoder", "xor.encrypt", new XOREncryptionEncoder());
		pipeline.addAfter("xor.encrypt", "update.encoder", new UpdateEncoder());
		pipeline.replace("handshake.decoder", "update.decoder", new UpdateDecoder());
	}

	pipeline.remove(this);
}
 
開發者ID:jordanabrahambaws,項目名稱:Quavo,代碼行數:15,代碼來源:HandshakeEncoder.java


注:本文中的io.netty.channel.ChannelPipeline.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。