or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

channel-building.mdindex.mdserver-building.mdssl-tls.mdtransport-providers.md
tile.json

tessl/maven-io-grpc--grpc-netty-shaded

A shaded version of the Netty transport for gRPC-Java that includes relocated Netty dependencies to avoid version conflicts

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/io.grpc/grpc-netty-shaded@1.73.x

To install, run

npx @tessl/cli install tessl/maven-io-grpc--grpc-netty-shaded@1.73.0

index.mddocs/

gRPC Netty Shaded

gRPC Netty Shaded provides a shaded version of the Netty transport implementation for gRPC-Java, designed to avoid dependency conflicts by relocating all Netty classes and resources under the io.grpc.netty.shaded namespace. This library includes the complete Netty transport functionality with relocated dependencies, native library support for multiple platforms, and specialized resource transformations to ensure proper shading of Netty's META-INF resources.

Package Information

  • Package Name: grpc-netty-shaded
  • Package Type: maven
  • Language: Java
  • Installation: implementation 'io.grpc:grpc-netty-shaded:1.73.0'
  • Group ID: io.grpc
  • Artifact ID: grpc-netty-shaded

Core Imports

import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder;
import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder;
import io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts;
import io.grpc.netty.shaded.io.grpc.netty.NettySslContextChannelCredentials;

Shaded Netty classes:

import io.grpc.netty.shaded.io.netty.channel.EventLoopGroup;
import io.grpc.netty.shaded.io.netty.handler.ssl.SslContext;
import io.grpc.netty.shaded.io.netty.channel.ChannelOption;

Basic Usage

import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder;
import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder;
import io.grpc.InsecureChannelCredentials;
import io.grpc.InsecureServerCredentials;
import io.grpc.ManagedChannel;
import io.grpc.Server;

// Create a client channel
ManagedChannel channel = NettyChannelBuilder
    .forAddress("localhost", 9090)
    .usePlaintext()
    .build();

// Create a server
Server server = NettyServerBuilder
    .forPort(9090)
    .addService(new MyServiceImpl())
    .build()
    .start();

// Cleanup
channel.shutdown();
server.shutdown();

Architecture

gRPC Netty Shaded is built around several key components:

  • Builder Pattern: NettyChannelBuilder and NettyServerBuilder provide fluent APIs for configuration
  • Shaded Dependencies: All Netty classes are relocated from io.netty.* to io.grpc.netty.shaded.io.netty.*
  • Transport Providers: Automatic discovery and registration of Netty transport via ServiceLoader
  • SSL/TLS Integration: Deep integration with Netty's SSL contexts and gRPC's security model
  • Platform Support: Native library support for Linux, macOS, and Windows across multiple architectures

Capabilities

Channel Building

Core client-side channel creation and configuration using Netty transport. Provides comprehensive options for connection tuning, security, and advanced Netty features.

public static NettyChannelBuilder forAddress(String host, int port);
public static NettyChannelBuilder forAddress(SocketAddress serverAddress);
public static NettyChannelBuilder forTarget(String target);

Key configuration methods:

public NettyChannelBuilder channelType(Class<? extends Channel> channelType);
public NettyChannelBuilder eventLoopGroup(EventLoopGroup eventLoopGroup);
public NettyChannelBuilder initialFlowControlWindow(int initialFlowControlWindow);
public NettyChannelBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit);

Channel Building

Server Building

Server-side gRPC server creation and configuration using Netty transport. Includes advanced connection management, SSL/TLS setup, and performance tuning options.

public static NettyServerBuilder forPort(int port);
public static NettyServerBuilder forAddress(SocketAddress address);

Key configuration methods:

public NettyServerBuilder channelType(Class<? extends ServerChannel> channelType);
public NettyServerBuilder bossEventLoopGroup(EventLoopGroup group);
public NettyServerBuilder workerEventLoopGroup(EventLoopGroup group);
public NettyServerBuilder maxConcurrentCallsPerConnection(int maxCalls);

Server Building

SSL/TLS Configuration

Comprehensive SSL/TLS support with Netty SSL contexts, optimized for gRPC with proper ALPN negotiation and certificate management.

public static SslContextBuilder forClient();
public static SslContextBuilder forServer(File keyCertChainFile, File keyFile);
public static ChannelCredentials create(SslContext sslContext);
public static ServerCredentials create(SslContext sslContext);

SSL/TLS Configuration

Transport Providers

Automatic discovery and registration of Netty transport providers, including Unix Domain Socket support and internal configuration APIs.

public boolean isAvailable();
public int priority();
public NettyChannelBuilder builderForAddress(String name, int port);
public NettyServerBuilder builderForPort(int port);

Transport Providers

Types

public enum NegotiationType {
    TLS,              // TLS ALPN/NPN negotiation for SSL connections
    PLAINTEXT_UPGRADE, // HTTP UPGRADE from HTTP/1.1 to HTTP/2
    PLAINTEXT         // Direct HTTP/2 plaintext connection
}

public static class LocalSocketPicker {
    public SocketAddress createSocketAddress(
        SocketAddress remoteAddress, 
        Attributes attrs);
}