diff --git a/java/README.md b/java/README.md
index 3d3263292..09dd2eb22 100644
--- a/java/README.md
+++ b/java/README.md
@@ -26,9 +26,20 @@ Add the following dependency to your project's `pom.xml` file:
```xml
+ import io.grpc.Grpc;
import io.grpc.ManagedChannel;
- import io.grpc.ManagedChannelBuilder;
+ import io.grpc.TlsChannelCredentials;
import org.hyperledger.fabric.client.*;
import org.hyperledger.fabric.client.identity.*;
@@ -38,8 +39,7 @@
PrivateKey privateKey = Identities.readPrivateKey(keyReader);
Signer signer = Signers.newPrivateKeySigner(privateKey);
- ManagedChannel grpcChannel = ManagedChannelBuilder.forAddress("gateway.example.org", 1337)
- .usePlaintext()
+ ManagedChannel grpcChannel = Grpc.newChannelBuilder("gateway.example.org:1337", TlsChannelCredentials.create())
.build();
Gateway.Builder builder = Gateway.newInstance()
diff --git a/java/src/test/java/scenario/ScenarioSteps.java b/java/src/test/java/scenario/ScenarioSteps.java
index 4848724d3..bf8ac7da6 100644
--- a/java/src/test/java/scenario/ScenarioSteps.java
+++ b/java/src/test/java/scenario/ScenarioSteps.java
@@ -15,11 +15,11 @@
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
+import io.grpc.ChannelCredentials;
+import io.grpc.Grpc;
import io.grpc.ManagedChannel;
import io.grpc.Status;
-import io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts;
-import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder;
-import io.grpc.netty.shaded.io.netty.handler.ssl.SslContext;
+import io.grpc.TlsChannelCredentials;
import org.hyperledger.fabric.client.ChaincodeEvent;
import org.hyperledger.fabric.client.GatewayException;
import org.hyperledger.fabric.client.identity.Identities;
@@ -330,11 +330,10 @@ public void createGatewayWithoutSigner(String name, String user, String mspId) t
@Given("I connect the gateway to {word}")
public void connectGateway(String name) throws Exception {
ConnectionInfo info = peerConnectionInfo.get(name);
- SslContext sslContext = GrpcSslContexts.forClient()
- .trustManager(Files.newInputStream(Paths.get(info.tlsRootCertPath)))
+ ChannelCredentials credentials = TlsChannelCredentials.newBuilder()
+ .trustManager(Paths.get(info.tlsRootCertPath).toFile())
.build();
- ManagedChannel channel = NettyChannelBuilder.forTarget(info.url)
- .sslContext(sslContext)
+ ManagedChannel channel = Grpc.newChannelBuilder(info.url, credentials)
.overrideAuthority(info.serverNameOverride)
.build();
currentGateway.connect(channel);