File tree Expand file tree Collapse file tree 6 files changed +83
-0
lines changed
api/src/main/java/io/grpc
core/src/main/java/io/grpc/inprocess
cronet/src/main/java/io/grpc/cronet
netty/src/main/java/io/grpc/netty
okhttp/src/main/java/io/grpc/okhttp Expand file tree Collapse file tree 6 files changed +83
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,16 @@ public T overrideAuthority(String authority) {
95
95
return thisT ();
96
96
}
97
97
98
+ /**
99
+ * @deprecated use {@link #usePlaintext()} instead.
100
+ */
101
+ @ Override
102
+ @ Deprecated
103
+ public T usePlaintext (boolean skipNegotiation ) {
104
+ delegate ().usePlaintext (skipNegotiation );
105
+ return thisT ();
106
+ }
107
+
98
108
@ Override
99
109
public T usePlaintext () {
100
110
delegate ().usePlaintext ();
Original file line number Diff line number Diff line change @@ -150,6 +150,27 @@ public static ManagedChannelBuilder<?> forTarget(String target) {
150
150
*/
151
151
public abstract T overrideAuthority (String authority );
152
152
153
+ /**
154
+ * Use of a plaintext connection to the server. By default a secure connection mechanism
155
+ * such as TLS will be used.
156
+ *
157
+ * <p>Should only be used for testing or for APIs where the use of such API or the data
158
+ * exchanged is not sensitive.
159
+ *
160
+ * @param skipNegotiation @{code true} if there is a priori knowledge that the endpoint supports
161
+ * plaintext, {@code false} if plaintext use must be negotiated.
162
+ * @deprecated Use {@link #usePlaintext()} instead.
163
+ *
164
+ * @throws UnsupportedOperationException if plaintext mode is not supported.
165
+ * @return this
166
+ * @since 1.0.0
167
+ */
168
+ @ ExperimentalApi ("https://github.com/grpc/grpc-java/issues/1772" )
169
+ @ Deprecated
170
+ public T usePlaintext (boolean skipNegotiation ) {
171
+ throw new UnsupportedOperationException ();
172
+ }
173
+
153
174
/**
154
175
* Use of a plaintext connection to the server. By default a secure connection mechanism
155
176
* such as TLS will be used.
Original file line number Diff line number Diff line change @@ -94,6 +94,17 @@ public InProcessChannelBuilder useTransportSecurity() {
94
94
return this ;
95
95
}
96
96
97
+ /**
98
+ * Does nothing.
99
+ *
100
+ * @deprecated use {@link #usePlaintext()} instead.
101
+ */
102
+ @ Override
103
+ @ Deprecated
104
+ public InProcessChannelBuilder usePlaintext (boolean skipNegotiation ) {
105
+ return this ;
106
+ }
107
+
97
108
/**
98
109
* Does nothing.
99
110
*/
Original file line number Diff line number Diff line change @@ -127,6 +127,14 @@ public final CronetChannelBuilder alwaysUsePut(boolean enable) {
127
127
return this ;
128
128
}
129
129
130
+ /**
131
+ * Not supported for building cronet channel.
132
+ */
133
+ @ Override
134
+ public final CronetChannelBuilder usePlaintext (boolean skipNegotiation ) {
135
+ throw new IllegalArgumentException ("Plaintext not currently supported" );
136
+ }
137
+
130
138
/**
131
139
* Sets {@link android.net.TrafficStats} tag to use when accounting socket traffic caused by this
132
140
* channel. See {@link android.net.TrafficStats} for more information. If no tag is set (e.g. this
Original file line number Diff line number Diff line change @@ -285,6 +285,23 @@ public NettyChannelBuilder maxInboundMetadataSize(int bytes) {
285
285
return this ;
286
286
}
287
287
288
+ /**
289
+ * Equivalent to using {@link #negotiationType(NegotiationType)} with {@code PLAINTEXT} or
290
+ * {@code PLAINTEXT_UPGRADE}.
291
+ *
292
+ * @deprecated use {@link #usePlaintext()} instead.
293
+ */
294
+ @ Override
295
+ @ Deprecated
296
+ public NettyChannelBuilder usePlaintext (boolean skipNegotiation ) {
297
+ if (skipNegotiation ) {
298
+ negotiationType (NegotiationType .PLAINTEXT );
299
+ } else {
300
+ negotiationType (NegotiationType .PLAINTEXT_UPGRADE );
301
+ }
302
+ return this ;
303
+ }
304
+
288
305
/**
289
306
* Equivalent to using {@link #negotiationType(NegotiationType)} with {@code PLAINTEXT}.
290
307
*/
Original file line number Diff line number Diff line change @@ -305,6 +305,22 @@ public final OkHttpChannelBuilder connectionSpec(
305
305
return this ;
306
306
}
307
307
308
+ /**
309
+ * Equivalent to using {@link #negotiationType} with {@code PLAINTEXT}.
310
+ *
311
+ * @deprecated use {@link #usePlaintext()} instead.
312
+ */
313
+ @ Override
314
+ @ Deprecated
315
+ public final OkHttpChannelBuilder usePlaintext (boolean skipNegotiation ) {
316
+ if (skipNegotiation ) {
317
+ negotiationType (io .grpc .okhttp .NegotiationType .PLAINTEXT );
318
+ } else {
319
+ throw new IllegalArgumentException ("Plaintext negotiation not currently supported" );
320
+ }
321
+ return this ;
322
+ }
323
+
308
324
/** Sets the negotiation type for the HTTP/2 connection to plaintext. */
309
325
@ Override
310
326
public final OkHttpChannelBuilder usePlaintext () {
You can’t perform that action at this time.
0 commit comments