use of org.apache.flink.shaded.netty4.io.netty.channel.embedded.EmbeddedChannel in project bgpcep by opendaylight.
the class BmpSessionImplTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
doReturn(null).when(this.mockedHandlerContext).channel();
doReturn(null).when(this.mockedHandlerContext).fireChannelInactive();
this.listener = new BmpTestSessionListener();
this.session = new BmpSessionImpl(this.listener);
this.channel = new EmbeddedChannel(this.session);
assertTrue(this.listener.isUp());
}
use of org.apache.flink.shaded.netty4.io.netty.channel.embedded.EmbeddedChannel in project reactor-netty by reactor.
the class HttpClientOperationsTest method addEncoderReplaysLastHttp.
@Test
public void addEncoderReplaysLastHttp() throws Exception {
ByteBuf buf = Unpooled.copiedBuffer("{\"foo\":1}", CharsetUtil.UTF_8);
EmbeddedChannel channel = new EmbeddedChannel();
HttpClientOperations ops = new HttpClientOperations(channel, (response, request) -> null, handler);
ops.addHandler(new JsonObjectDecoder());
channel.writeInbound(new DefaultLastHttpContent(buf));
assertThat(channel.pipeline().names().iterator().next(), is("JsonObjectDecoder$extractor"));
Object content = channel.readInbound();
assertThat(content, instanceOf(ByteBuf.class));
((ByteBuf) content).release();
content = channel.readInbound();
assertThat(content, instanceOf(LastHttpContent.class));
((LastHttpContent) content).release();
assertThat(channel.readInbound(), nullValue());
}
use of org.apache.flink.shaded.netty4.io.netty.channel.embedded.EmbeddedChannel in project reactor-netty by reactor.
the class HttpClientOperationsTest method testConstructorWithProvidedReplacement.
@Test
public void testConstructorWithProvidedReplacement() {
EmbeddedChannel channel = new EmbeddedChannel();
channel.pipeline().addFirst(NettyPipeline.SslHandler, new ChannelHandlerAdapter() {
});
HttpClientOperations ops1 = new HttpClientOperations(channel, (response, request) -> null, handler);
ops1.followRedirect();
ops1.failOnClientError(false);
ops1.failOnServerError(false);
HttpClientOperations ops2 = new HttpClientOperations(channel, ops1);
assertSame(ops1.channel(), ops2.channel());
assertSame(ops1.started, ops2.started);
assertSame(ops1.redirectedFrom, ops2.redirectedFrom);
assertSame(ops1.isSecure, ops2.isSecure);
assertSame(ops1.nettyRequest, ops2.nettyRequest);
assertSame(ops1.responseState, ops2.responseState);
assertSame(ops1.redirectable, ops2.redirectable);
assertSame(ops1.inboundPrefetch, ops2.inboundPrefetch);
assertSame(ops1.requestHeaders, ops2.requestHeaders);
assertSame(ops1.clientError, ops2.clientError);
assertSame(ops1.serverError, ops2.serverError);
}
use of org.apache.flink.shaded.netty4.io.netty.channel.embedded.EmbeddedChannel in project reactor-netty by reactor.
the class HttpClientOperationsTest method addDecoderReplaysLastHttp.
@Test
public void addDecoderReplaysLastHttp() throws Exception {
ByteBuf buf = Unpooled.copiedBuffer("{\"foo\":1}", CharsetUtil.UTF_8);
EmbeddedChannel channel = new EmbeddedChannel();
HttpClientOperations ops = new HttpClientOperations(channel, (response, request) -> null, handler);
ops.addHandler(new JsonObjectDecoder());
channel.writeInbound(new DefaultLastHttpContent(buf));
assertThat(channel.pipeline().names().iterator().next(), is("JsonObjectDecoder$extractor"));
Object content = channel.readInbound();
assertThat(content, instanceOf(ByteBuf.class));
((ByteBuf) content).release();
content = channel.readInbound();
assertThat(content, instanceOf(LastHttpContent.class));
((LastHttpContent) content).release();
assertThat(channel.readInbound(), nullValue());
}
use of org.apache.flink.shaded.netty4.io.netty.channel.embedded.EmbeddedChannel in project reactor-netty by reactor.
the class NettyContextTest method init.
@Before
public void init() {
channel = new EmbeddedChannel();
testContext = () -> channel;
}
Aggregations