Metadata header=new Metadata();
Metadata.Key<String> key = Metadata.Key.of("token", Metadata.ASCII_STRING_MARSHALLER);
header.put(key, "aaa");
ManagedChannel locationChannel = ManagedChannelBuilder.forAddress(GRPCConst.URL.LOCALHOST, GRPCConst.URL.LOCALHOST_PORT).usePlaintext().build();
ManagedChannel dispatcherChannel = ManagedChannelBuilder.forAddress(
GRPCConst.URL.DISPATCHER_HOST, GRPCConst.URL.DISPATCHER_PORT)
.usePlaintext()
.intercept(MetadataUtils.newAttachHeadersInterceptor(header))
.build();
Tests failing when using ClientInterceptor to add headers to the stub
In the following code MetadataUtils.attachHeaders is deprecated (I'm using grpc 1.45.1): "request without bearer token should fail" { val channel: ManagedChannel =
stackoverflow.com
'Mobile > Android' 카테고리의 다른 글
| [Android] [Kotlin] 정규 표현식 정리 (0) | 2022.10.31 |
|---|---|
| [Android] 미디어 볼륨 강제로 조절 (0) | 2022.10.22 |
| [해결][Android Error] java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.5.0-runtime (0) | 2022.10.22 |
| [Android] 안드로이드 스튜디오 단축키 (기본 단축키부터 코딩시 단축키까지) (0) | 2022.10.21 |
| [Android] 액티비티, 프래그먼트 생명주기에 대한 고찰 (03/10 수정: 화면 회전시 추가) (0) | 2022.10.21 |