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 - org.hyperledger.fabric - fabric-gateway - 1.1.0 + org.hyperledger.fabric + fabric-gateway + 1.2.2 + +``` + +A suitable gRPC channel service provider must also be specified (as described in the [gRPC security documentation](https://github.com/grpc/grpc-java/blob/master/SECURITY.md#transport-security-tls)), such as: + +```xml + + io.grpc + grpc-netty-shaded + 1.54.1 + runtime ``` @@ -37,7 +48,13 @@ Add the following dependency to your project's `pom.xml` file: Add the following dependency to your project's `build.gradle` file: ```groovy -implementation 'org.hyperledger.fabric:fabric-gateway:1.1.0' +implementation 'org.hyperledger.fabric:fabric-gateway:1.2.2' +``` + +A suitable gRPC channel service provider must also be specified (as described in the [gRPC security documentation](https://github.com/grpc/grpc-java/blob/master/SECURITY.md#transport-security-tls)), such as: + +```groovy +runtimeOnly 'io.grpc:grpc-netty-shaded:1.54.1' ``` ## Compatibility diff --git a/java/pom.xml b/java/pom.xml index aa723146d..50a3703f1 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -38,10 +38,10 @@ UTF-8 8 - 1.54.0 - 3.21.12 + 1.54.1 + 3.21.12 1.8 - 1.72 + 1.73 ${skipTests} @@ -50,14 +50,14 @@ io.cucumber cucumber-bom - 7.11.2 + 7.12.0 pom import org.junit junit-bom - 5.9.2 + 5.9.3 pom import @@ -130,6 +130,7 @@ io.grpc grpc-netty-shaded + test io.grpc @@ -372,7 +373,7 @@ com.puppycrawl.tools checkstyle - 10.9.3 + 10.10.0 diff --git a/java/src/main/javadoc/overview.html b/java/src/main/javadoc/overview.html index 4af04e7d2..404978e26 100644 --- a/java/src/main/javadoc/overview.html +++ b/java/src/main/javadoc/overview.html @@ -24,8 +24,9 @@ the ledger state using an instantiated smart contract.


+    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);