
org.testifyproject.netty.channel.embedded.EmbeddedChannel Maven / Gradle / Ivy
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in org.testifyproject.testifyprojectpliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org.testifyproject/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package org.testifyproject.testifyproject.netty.channel.embedded;
import org.testifyproject.testifyproject.netty.channel.AbstractChannel;
import org.testifyproject.testifyproject.netty.channel.Channel;
import org.testifyproject.testifyproject.netty.channel.ChannelConfig;
import org.testifyproject.testifyproject.netty.channel.ChannelFuture;
import org.testifyproject.testifyproject.netty.channel.ChannelHandler;
import org.testifyproject.testifyproject.netty.channel.ChannelHandlerContext;
import org.testifyproject.testifyproject.netty.channel.ChannelId;
import org.testifyproject.testifyproject.netty.channel.ChannelInboundHandlerAdapter;
import org.testifyproject.testifyproject.netty.channel.ChannelInitializer;
import org.testifyproject.testifyproject.netty.channel.ChannelMetadata;
import org.testifyproject.testifyproject.netty.channel.ChannelOutboundBuffer;
import org.testifyproject.testifyproject.netty.channel.ChannelPipeline;
import org.testifyproject.testifyproject.netty.channel.ChannelPromise;
import org.testifyproject.testifyproject.netty.channel.DefaultChannelConfig;
import org.testifyproject.testifyproject.netty.channel.EventLoop;
import org.testifyproject.testifyproject.netty.util.ReferenceCountUtil;
import org.testifyproject.testifyproject.netty.util.internal.ObjectUtil;
import org.testifyproject.testifyproject.netty.util.internal.PlatformDependent;
import org.testifyproject.testifyproject.netty.util.internal.RecyclableArrayList;
import org.testifyproject.testifyproject.netty.util.internal.logging.InternalLogger;
import org.testifyproject.testifyproject.netty.util.internal.logging.InternalLoggerFactory;
import java.net.SocketAddress;
import java.nio.channels.ClosedChannelException;
import java.util.ArrayDeque;
import java.util.Queue;
/**
* Base class for {@link Channel} implementations that are used in an embedded fashion.
*/
public class EmbeddedChannel extends AbstractChannel {
private static final SocketAddress LOCAL_ADDRESS = new EmbeddedSocketAddress();
private static final SocketAddress REMOTE_ADDRESS = new EmbeddedSocketAddress();
private static final ChannelHandler[] EMPTY_HANDLERS = new ChannelHandler[0];
private enum State { OPEN, ACTIVE, CLOSED }
private static final InternalLogger logger = InternalLoggerFactory.getInstance(EmbeddedChannel.class);
private static final ChannelMetadata METADATA_NO_DISCONNECT = new ChannelMetadata(false);
private static final ChannelMetadata METADATA_DISCONNECT = new ChannelMetadata(true);
private final EmbeddedEventLoop loop = new EmbeddedEventLoop();
private final ChannelMetadata metadata;
private final ChannelConfig config;
private Queue
© 2015 - 2025 Weber Informatics LLC | Privacy Policy