From fc54fc3f245d83b40f20e6aa552ded2823420081 Mon Sep 17 00:00:00 2001 From: Redkale <22250530@qq.com> Date: Mon, 13 Nov 2017 21:09:24 +0800 Subject: [PATCH] --- src/org/redkale/net/AsyncConnection.java | 36 ------------------------ 1 file changed, 36 deletions(-) diff --git a/src/org/redkale/net/AsyncConnection.java b/src/org/redkale/net/AsyncConnection.java index 6c3001119..bccf790c6 100644 --- a/src/org/redkale/net/AsyncConnection.java +++ b/src/org/redkale/net/AsyncConnection.java @@ -122,42 +122,6 @@ public abstract class AsyncConnection implements AsynchronousByteChannel, AutoCl } //------------------------------------------------------------------------------------------------------------------------------ - public static AsyncConnection create(final String protocol, final AsynchronousChannelGroup group, final SocketAddress address) throws IOException { - return create(protocol, group, address, 0, 0); - } - - /** - * 创建客户端连接 - * - * @param protocol 连接类型 只能是TCP或UDP - * @param address 连接点子 - * @param group 连接AsynchronousChannelGroup - * @param readTimeoutSecond0 读取超时秒数 - * @param writeTimeoutSecond0 写入超时秒数 - * - * @return 连接 - * @throws java.io.IOException 异常 - */ - public static AsyncConnection create(final String protocol, final AsynchronousChannelGroup group, final SocketAddress address, - final int readTimeoutSecond0, final int writeTimeoutSecond0) throws IOException { - if ("TCP".equalsIgnoreCase(protocol)) { - AsynchronousSocketChannel channel = AsynchronousSocketChannel.open(group); - try { - channel.connect(address).get(3, TimeUnit.SECONDS); - } catch (Exception e) { - throw new IOException("AsyncConnection connect " + address, e); - } - return create(channel, address, readTimeoutSecond0, writeTimeoutSecond0); - } else if ("UDP".equalsIgnoreCase(protocol)) { - DatagramChannel channel = DatagramChannel.open(); - channel.configureBlocking(true); - channel.connect(address); - return create(channel, address, true, readTimeoutSecond0, writeTimeoutSecond0); - } else { - throw new RuntimeException("AsyncConnection not support protocol " + protocol); - } - } - /** * 创建TCP协议客户端连接 *