ChannelPipeline next = Channels.pipeline(); next.addLast("frameDecoder", new ProtobufVarint32FrameDecoder()); next.addLast("protobufDecoder", new ProtobufDecoder(TestMessage.getDefaultInstance())); next.addLast("frameEncoder", new ProtobufVarint32LengthFieldPrepender()); next.addLast("protobufEncoder", new ProtobufEncoder()); next.addLast("protobufHandler", new ProtobufHandler()); //add this.
public AvaticaProtobufHandler(Service service, MetricsSystem metrics, AvaticaServerConfiguration serverConfig) { this.service = Objects.requireNonNull(service); this.metrics = Objects.requireNonNull(metrics); this.requestTimer = this.metrics.getTimer( MetricsHelper.concat(AvaticaProtobufHandler.class, MetricsAwareAvaticaHandler.REQUEST_TIMER_NAME)); this.protobufTranslation = new ProtobufTranslationImpl(); this.pbHandler = new ProtobufHandler(service, protobufTranslation, metrics); this.threadLocalBuffer = new ThreadLocal<UnsynchronizedBuffer>() { @Override public UnsynchronizedBuffer initialValue() { return new UnsynchronizedBuffer(); } }; this.serverConfig = serverConfig; }
public AvaticaProtobufHandler(Service service, MetricsSystem metrics, AvaticaServerConfiguration serverConfig) { this.service = Objects.requireNonNull(service); this.metrics = Objects.requireNonNull(metrics); this.requestTimer = this.metrics.getTimer( MetricsHelper.concat(AvaticaProtobufHandler.class, MetricsAwareAvaticaHandler.REQUEST_TIMER_NAME)); this.protobufTranslation = new ProtobufTranslationImpl(); this.pbHandler = new ProtobufHandler(service, protobufTranslation, metrics); this.threadLocalBuffer = new ThreadLocal<UnsynchronizedBuffer>() { @Override public UnsynchronizedBuffer initialValue() { return new UnsynchronizedBuffer(); } }; this.serverConfig = serverConfig; }
@Before public void setupMocks() { // Mocks service = Mockito.mock(Service.class); translation = Mockito.mock(ProtobufTranslation.class); // Real objects handler = new ProtobufHandler(service, translation); }
@Before public void setupMocks() { // Mocks service = Mockito.mock(Service.class); translation = Mockito.mock(ProtobufTranslation.class); // Real objects handler = new ProtobufHandler(service, translation, NoopMetricsSystem.getInstance()); }
@Before public void setupMocks() { // Mocks service = Mockito.mock(Service.class); translation = Mockito.mock(ProtobufTranslation.class); // Real objects handler = new ProtobufHandler(service, translation, NoopMetricsSystem.getInstance()); }