mirror of https://github.com/grpc/grpc-java.git
s2a: Don't allow S2AStub to be set
S2AStub is an internal API and shouldn't be used outside of s2a. It is still available for tests. IntegrationTest was moved to io.grpc.s2a. It uses a io.grpc.s2a class, so shouldn't be in internal.handler
This commit is contained in:
parent
9e54e8e5e9
commit
16d26726cf
|
|
@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||||
|
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
||||||
import io.grpc.Channel;
|
import io.grpc.Channel;
|
||||||
import io.grpc.ChannelCredentials;
|
import io.grpc.ChannelCredentials;
|
||||||
|
|
@ -110,7 +111,8 @@ public final class S2AChannelCredentials {
|
||||||
* Sets the stub to use to communicate with S2A. This is only used for testing that the
|
* Sets the stub to use to communicate with S2A. This is only used for testing that the
|
||||||
* stream to S2A gets closed.
|
* stream to S2A gets closed.
|
||||||
*/
|
*/
|
||||||
public Builder setStub(S2AStub stub) {
|
@VisibleForTesting
|
||||||
|
Builder setStub(S2AStub stub) {
|
||||||
checkNotNull(stub);
|
checkNotNull(stub);
|
||||||
this.stub = stub;
|
this.stub = stub;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,8 @@ public class S2AStub implements AutoCloseable {
|
||||||
private boolean doneWriting = false;
|
private boolean doneWriting = false;
|
||||||
private boolean isClosed = false;
|
private boolean isClosed = false;
|
||||||
|
|
||||||
static S2AStub newInstance(S2AServiceGrpc.S2AServiceStub serviceStub) {
|
@VisibleForTesting
|
||||||
|
public static S2AStub newInstance(S2AServiceGrpc.S2AServiceStub serviceStub) {
|
||||||
checkNotNull(serviceStub);
|
checkNotNull(serviceStub);
|
||||||
return new S2AStub(serviceStub);
|
return new S2AStub(serviceStub);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.grpc.s2a.internal.handshaker;
|
package io.grpc.s2a;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||||
|
|
@ -37,6 +37,8 @@ import io.grpc.netty.NettyServerBuilder;
|
||||||
import io.grpc.s2a.S2AChannelCredentials;
|
import io.grpc.s2a.S2AChannelCredentials;
|
||||||
import io.grpc.s2a.internal.channel.S2AHandshakerServiceChannel;
|
import io.grpc.s2a.internal.channel.S2AHandshakerServiceChannel;
|
||||||
import io.grpc.s2a.internal.handshaker.FakeS2AServer;
|
import io.grpc.s2a.internal.handshaker.FakeS2AServer;
|
||||||
|
import io.grpc.s2a.internal.handshaker.S2AServiceGrpc;
|
||||||
|
import io.grpc.s2a.internal.handshaker.S2AStub;
|
||||||
import io.grpc.stub.StreamObserver;
|
import io.grpc.stub.StreamObserver;
|
||||||
import io.grpc.testing.protobuf.SimpleRequest;
|
import io.grpc.testing.protobuf.SimpleRequest;
|
||||||
import io.grpc.testing.protobuf.SimpleResponse;
|
import io.grpc.testing.protobuf.SimpleResponse;
|
||||||
Loading…
Reference in New Issue