use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project grpc-java by grpc.
the class AbstractClientStream2Test method inboundHeadersReceived_acceptsGzipEncoding.
@Test
public void inboundHeadersReceived_acceptsGzipEncoding() {
AbstractClientStream2 stream = new BaseAbstractClientStream(allocator, statsTraceCtx);
stream.start(mockListener);
Metadata headers = new Metadata();
headers.put(GrpcUtil.MESSAGE_ENCODING_KEY, new Codec.Gzip().getMessageEncoding());
stream.transportState().inboundHeadersReceived(headers);
verify(mockListener).headersRead(headers);
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project grpc-java by grpc.
the class AbstractClientStream2Test method inboundHeadersReceived_acceptsIdentityEncoding.
@Test
public void inboundHeadersReceived_acceptsIdentityEncoding() {
AbstractClientStream2 stream = new BaseAbstractClientStream(allocator, statsTraceCtx);
stream.start(mockListener);
Metadata headers = new Metadata();
headers.put(GrpcUtil.MESSAGE_ENCODING_KEY, Codec.Identity.NONE.getMessageEncoding());
stream.transportState().inboundHeadersReceived(headers);
verify(mockListener).headersRead(headers);
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project grpc-java by grpc.
the class AbstractClientStream2Test method inboundHeadersReceived_failsIfStatusReported.
@Test
public void inboundHeadersReceived_failsIfStatusReported() {
AbstractClientStream2 stream = new BaseAbstractClientStream(allocator, statsTraceCtx);
stream.start(mockListener);
stream.transportState().transportReportStatus(Status.CANCELLED, false, new Metadata());
TransportState state = stream.transportState();
thrown.expect(IllegalStateException.class);
state.inboundHeadersReceived(new Metadata());
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project grpc-java by grpc.
the class AbstractClientStreamTest method inboundHeadersReceived_acceptsIdentityEncoding.
@Test
public void inboundHeadersReceived_acceptsIdentityEncoding() {
AbstractClientStream stream = new BaseAbstractClientStream(allocator);
stream.start(mockListener);
Metadata headers = new Metadata();
headers.put(GrpcUtil.MESSAGE_ENCODING_KEY, Codec.Identity.NONE.getMessageEncoding());
stream.inboundHeadersReceived(headers);
verify(mockListener).headersRead(headers);
}
use of org.apache.beam.vendor.grpc.v1p43p2.io.grpc.Metadata in project grpc-java by grpc.
the class AbstractClientStreamTest method inboundHeadersReceived_failsOnPhaseStatus.
@Test
public void inboundHeadersReceived_failsOnPhaseStatus() {
AbstractClientStream stream = new BaseAbstractClientStream(allocator);
stream.start(mockListener);
Metadata headers = new Metadata();
stream.inboundPhase(Phase.STATUS);
thrown.expect(IllegalStateException.class);
stream.inboundHeadersReceived(headers);
}
Aggregations