UDTClientServerConnectionTest Class — netty Architecture
Architecture documentation for the UDTClientServerConnectionTest class in UDTClientServerConnectionTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD d1f4d11f_273b_d830_ba49_5a533bb67ca2["UDTClientServerConnectionTest"] f3540ce4_30eb_36e3_f952_e84f7d4af406["UDTClientServerConnectionTest.java"] d1f4d11f_273b_d830_ba49_5a533bb67ca2 -->|defined in| f3540ce4_30eb_36e3_f952_e84f7d4af406 156270fd_9bf9_064f_a94f_9c4261373402["assumeUdt()"] d1f4d11f_273b_d830_ba49_5a533bb67ca2 -->|method| 156270fd_9bf9_064f_a94f_9c4261373402 f96c77a4_1fb3_24aa_203d_90d9476ee200["canLoadAndInit()"] d1f4d11f_273b_d830_ba49_5a533bb67ca2 -->|method| f96c77a4_1fb3_24aa_203d_90d9476ee200 098a2fa4_b848_c4c1_4779_df3351dcad97["connection()"] d1f4d11f_273b_d830_ba49_5a533bb67ca2 -->|method| 098a2fa4_b848_c4c1_4779_df3351dcad97
Relationship Graph
Source Code
testsuite/src/main/java/io/netty/testsuite/transport/udt/UDTClientServerConnectionTest.java lines 57–400
public class UDTClientServerConnectionTest {
static class Client implements Runnable {
static final Logger log = LoggerFactory.getLogger(Client.class);
private final InetSocketAddress address;
volatile Channel channel;
volatile boolean isRunning;
volatile boolean isShutdown;
Client(InetSocketAddress address) {
this.address = address;
}
@Override
public void run() {
final Bootstrap boot = new Bootstrap();
final ThreadFactory clientFactory = new DefaultThreadFactory("client");
final EventLoopGroup connectGroup = new MultiThreadIoEventLoopGroup(1,
clientFactory, NioIoHandler.newFactory(NioUdtProvider.BYTE_PROVIDER));
try {
boot.group(connectGroup)
.channelFactory(NioUdtProvider.BYTE_CONNECTOR)
.handler(new ChannelInitializer<UdtChannel>() {
@Override
protected void initChannel(final UdtChannel ch)
throws Exception {
final ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast("framer",
new DelimiterBasedFrameDecoder(8192,
Delimiters.lineDelimiter()));
pipeline.addLast("decoder", new StringDecoder(
CharsetUtil.UTF_8));
pipeline.addLast("encoder", new StringEncoder(
CharsetUtil.UTF_8));
pipeline.addLast("handler", new ClientHandler());
}
});
channel = boot.connect(address).sync().channel();
isRunning = true;
log.info("Client ready.");
waitForRunning(false);
log.info("Client closing...");
channel.close().sync();
isShutdown = true;
log.info("Client is done.");
} catch (final Throwable e) {
log.error("Client failed.", e);
} finally {
connectGroup.shutdownGracefully().syncUninterruptibly();
}
}
void shutdown() {
isRunning = false;
}
void waitForActive(final boolean isActive) throws Exception {
for (int k = 0; k < WAIT_COUNT; k++) {
Thread.sleep(WAIT_SLEEP);
final ClientHandler handler = channel.pipeline().get(
ClientHandler.class);
if (handler != null && isActive == handler.isActive) {
return;
}
}
}
void waitForRunning(final boolean isRunning) throws Exception {
for (int k = 0; k < WAIT_COUNT; k++) {
if (isRunning == this.isRunning) {
return;
}
Thread.sleep(WAIT_SLEEP);
}
}
private void waitForShutdown() throws Exception {
Defined In
Source
Frequently Asked Questions
What is the UDTClientServerConnectionTest class?
UDTClientServerConnectionTest is a class in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/udt/UDTClientServerConnectionTest.java.
Where is UDTClientServerConnectionTest defined?
UDTClientServerConnectionTest is defined in testsuite/src/main/java/io/netty/testsuite/transport/udt/UDTClientServerConnectionTest.java at line 57.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free