List of usage examples for io.netty.buffer ByteBufAllocator DEFAULT
ByteBufAllocator DEFAULT
To view the source code for io.netty.buffer ByteBufAllocator DEFAULT.
Click Source Link
From source file:eu.stratosphere.runtime.io.network.netty.InboundEnvelopeDecoderTest.java
License:Apache License
private static ByteBuf encode(EmbeddedChannel ch, Envelope... envelopes) { for (Envelope env : envelopes) { ch.writeOutbound(env);//ww w . j a va2 s. c o m if (env.getBuffer() != null) { verify(env.getBuffer(), times(1)).recycleBuffer(); } } CompositeByteBuf encodedEnvelopes = new CompositeByteBuf(ByteBufAllocator.DEFAULT, false, envelopes.length); ByteBuf buf; while ((buf = (ByteBuf) ch.readOutbound()) != null) { encodedEnvelopes.addComponent(buf); } return encodedEnvelopes.writerIndex(encodedEnvelopes.capacity()); }
From source file:io.airlift.drift.transport.netty.client.DriftNettyClientModule.java
License:Apache License
public DriftNettyClientModule() { this(ByteBufAllocator.DEFAULT); }
From source file:io.airlift.drift.transport.netty.client.DriftNettyMethodInvokerFactory.java
License:Apache License
public static DriftNettyMethodInvokerFactory<?> createStaticDriftNettyMethodInvokerFactory( DriftNettyClientConfig clientConfig) { return createStaticDriftNettyMethodInvokerFactory(clientConfig, ByteBufAllocator.DEFAULT); }
From source file:io.airlift.drift.transport.netty.client.DriftNettyMethodInvokerFactory.java
License:Apache License
public DriftNettyMethodInvokerFactory(DriftNettyConnectionFactoryConfig factoryConfig, Function<I, DriftNettyClientConfig> clientConfigurationProvider) { this(factoryConfig, clientConfigurationProvider, ByteBufAllocator.DEFAULT); }
From source file:io.airlift.drift.transport.netty.server.DriftNettyServerTransport.java
License:Apache License
public DriftNettyServerTransport(ServerMethodInvoker methodInvoker, DriftNettyServerConfig config) { this(methodInvoker, config, ByteBufAllocator.DEFAULT); }
From source file:io.airlift.drift.transport.netty.server.DriftNettyServerTransportFactory.java
License:Apache License
public DriftNettyServerTransportFactory(DriftNettyServerConfig config) { this(config, ByteBufAllocator.DEFAULT); }
From source file:io.andromeda.logcollector.LocalFileReader.java
License:Apache License
private Observable.Operator<String, Buffer> extractLines() { ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(8192); return subscriber -> new Subscriber<Buffer>() { @Override//w ww.ja va 2s. c om public void onCompleted() { if (!subscriber.isUnsubscribed()) { subscriber.onCompleted(); } } @Override public void onError(Throwable e) { if (!subscriber.isUnsubscribed()) { subscriber.onError(e); } } @Override public void onNext(Buffer buffer) { ByteBuf _buf = ((io.vertx.core.buffer.Buffer) buffer.getDelegate()).getByteBuf(); while (_buf.readableBytes() > 0) { byte b = _buf.readByte(); if ((b == '\n') || (b == '\r')) { byte[] _bArr = new byte[buf.readableBytes()]; buf.readBytes(_bArr); subscriber.onNext(new String(_bArr)); } else { buf.writeByte(b); } } buf.clear(); } }; }
From source file:io.crate.auth.HostBasedAuthenticationTest.java
@Before private void setUpTest() throws Exception { SelfSignedCertificate ssc = new SelfSignedCertificate(); SslHandler sslHandler = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()) .trustManager(InsecureTrustManagerFactory.INSTANCE).startTls(false).build() .newHandler(ByteBufAllocator.DEFAULT); sslSession = sslHandler.engine().getSession(); }
From source file:io.crate.operation.auth.HostBasedAuthenticationTest.java
@Before private void setUpTest() throws Exception { Settings settings = Settings.builder().put(AuthSettings.AUTH_HOST_BASED_ENABLED_SETTING.getKey(), true) .build();/* ww w . j a va 2 s. co m*/ authService = new HostBasedAuthentication(settings, null); SelfSignedCertificate ssc = new SelfSignedCertificate(); SslHandler sslHandler = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()) .trustManager(InsecureTrustManagerFactory.INSTANCE).startTls(false).build() .newHandler(ByteBufAllocator.DEFAULT); sslSession = sslHandler.engine().getSession(); }
From source file:io.gatling.http.client.body.FormUrlEncodedRequestBodyTest.java
License:Apache License
private void formUrlEncoding(Charset charset) throws Exception { String key = "key"; String value = ""; List<Param> params = new ArrayList<>(); params.add(new Param(key, value)); ByteBuf bb = (ByteBuf) new FormUrlEncodedRequestBody(params, TEXT_PLAIN.toString(), charset) .build(false, ByteBufAllocator.DEFAULT).getContent(); try {/*from w w w.j a v a2 s. c om*/ String ahcString = ByteBufUtils.byteBuf2String(US_ASCII, bb); String jdkString = key + "=" + URLEncoder.encode(value, charset.name()); assertEquals(ahcString, jdkString); } finally { bb.release(); } }