Move non socket specific stuff out of the socket package
This commit is contained in:
parent
bfe44180f9
commit
ade3cc1329
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
import io.netty.channel.AbstractChannel;
|
||||
import io.netty.channel.Channel;
|
||||
@ -21,7 +21,6 @@ import io.netty.channel.ChannelPromise;
|
||||
import io.netty.channel.EventLoop;
|
||||
|
||||
import java.net.ConnectException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.channels.AsynchronousChannel;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
@ -31,7 +30,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* Abstract base class for {@link Channel} implementations that use the new {@link AsynchronousChannel} which is part
|
||||
* of NIO.2.
|
||||
*/
|
||||
abstract class AbstractAioChannel extends AbstractChannel {
|
||||
public abstract class AbstractAioChannel extends AbstractChannel {
|
||||
|
||||
protected volatile AsynchronousChannel ch;
|
||||
|
||||
@ -60,16 +59,6 @@ abstract class AbstractAioChannel extends AbstractChannel {
|
||||
this.ch = ch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress localAddress() {
|
||||
return (InetSocketAddress) super.localAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress remoteAddress() {
|
||||
return (InetSocketAddress) super.remoteAddress();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the underlying {@link AsynchronousChannel}. Be aware this should only be called after it was set as
|
||||
* otherwise it will throw an {@link IllegalStateException}.
|
||||
@ -149,13 +138,13 @@ abstract class AbstractAioChannel extends AbstractChannel {
|
||||
}
|
||||
}
|
||||
|
||||
protected void connectFailed(Throwable t) {
|
||||
public void connectFailed(Throwable t) {
|
||||
connectPromise.setFailure(t);
|
||||
pipeline().fireExceptionCaught(t);
|
||||
closeIfClosed();
|
||||
}
|
||||
|
||||
protected void connectSuccess() {
|
||||
public void connectSuccess() {
|
||||
assert eventLoop().inEventLoop();
|
||||
assert connectPromise != null;
|
||||
try {
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
/**
|
||||
* Allow to fine the {@link AbstractAioChannel} for a task.
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.EventLoop;
|
||||
@ -23,7 +23,7 @@ import java.nio.channels.CompletionHandler;
|
||||
/**
|
||||
* Special {@link CompletionHandler} which makes sure that the callback methods gets executed in the {@link EventLoop}
|
||||
*/
|
||||
abstract class AioCompletionHandler<V, A extends Channel> implements CompletionHandler<V, A> {
|
||||
public abstract class AioCompletionHandler<V, A extends Channel> implements CompletionHandler<V, A> {
|
||||
|
||||
/**
|
||||
* See {@link CompletionHandler#completed(Object, Object)}
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFuture;
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelTaskScheduler;
|
||||
@ -59,7 +59,11 @@ public class AioEventLoopGroup extends MultithreadEventLoopGroup {
|
||||
}
|
||||
|
||||
private final AioExecutorService groupExecutor = new AioExecutorService();
|
||||
final AsynchronousChannelGroup group;
|
||||
private final AsynchronousChannelGroup group;
|
||||
|
||||
public AsynchronousChannelGroup channelGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new instance which use the default number of threads of {@link #DEFAULT_POOL_SIZE}.
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* <a href="http://en.wikipedia.org/wiki/New_I/O">NIO2</a>-based channel
|
||||
* API implementation - recommended for a large number of connections (>= 1000).
|
||||
*
|
||||
* NIO2 is only supported on Java 7+.
|
||||
*/
|
||||
package io.netty.channel.aio;
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.nio;
|
||||
package io.netty.channel.nio;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
@ -30,7 +30,7 @@ import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.WritableByteChannel;
|
||||
|
||||
/**
|
||||
* {@link AbstractNioChannel} base class for {@link Channel}s that operate on bytes.
|
||||
* {@link io.netty.channel.nio.AbstractNioChannel} base class for {@link Channel}s that operate on bytes.
|
||||
*/
|
||||
public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
||||
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.nio;
|
||||
package io.netty.channel.nio;
|
||||
|
||||
import io.netty.channel.AbstractChannel;
|
||||
import io.netty.channel.Channel;
|
||||
@ -25,7 +25,6 @@ import io.netty.logging.InternalLoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.channels.CancelledKeyException;
|
||||
import java.nio.channels.SelectableChannel;
|
||||
@ -91,16 +90,6 @@ public abstract class AbstractNioChannel extends AbstractChannel {
|
||||
return ch.isOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress localAddress() {
|
||||
return (InetSocketAddress) super.localAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress remoteAddress() {
|
||||
return (InetSocketAddress) super.remoteAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NioUnsafe unsafe() {
|
||||
return (NioUnsafe) super.unsafe();
|
||||
@ -126,7 +115,7 @@ public abstract class AbstractNioChannel extends AbstractChannel {
|
||||
/**
|
||||
* Return {@code true} if the input of this {@link Channel} is shutdown
|
||||
*/
|
||||
boolean isInputShutdown() {
|
||||
protected boolean isInputShutdown() {
|
||||
return inputShutdown;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.nio;
|
||||
package io.netty.channel.nio;
|
||||
|
||||
import io.netty.buffer.MessageBuf;
|
||||
import io.netty.channel.Channel;
|
||||
@ -24,7 +24,7 @@ import java.nio.channels.SelectableChannel;
|
||||
import java.nio.channels.SelectionKey;
|
||||
|
||||
/**
|
||||
* {@link AbstractNioChannel} base class for {@link Channel}s that operate on messages.
|
||||
* {@link io.netty.channel.nio.AbstractNioChannel} base class for {@link Channel}s that operate on messages.
|
||||
*/
|
||||
public abstract class AbstractNioMessageChannel extends AbstractNioChannel {
|
||||
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.nio;
|
||||
package io.netty.channel.nio;
|
||||
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
@ -21,7 +21,7 @@ import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelTaskScheduler;
|
||||
import io.netty.channel.EventLoopException;
|
||||
import io.netty.channel.SingleThreadEventLoop;
|
||||
import io.netty.channel.socket.nio.AbstractNioChannel.NioUnsafe;
|
||||
import io.netty.channel.nio.AbstractNioChannel.NioUnsafe;
|
||||
import io.netty.logging.InternalLogger;
|
||||
import io.netty.logging.InternalLoggerFactory;
|
||||
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.nio;
|
||||
package io.netty.channel.nio;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelTaskScheduler;
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.nio;
|
||||
package io.netty.channel.nio;
|
||||
|
||||
import java.nio.channels.SelectableChannel;
|
||||
import java.nio.channels.SelectionKey;
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.nio;
|
||||
package io.netty.channel.nio;
|
||||
|
||||
import io.netty.logging.InternalLogger;
|
||||
import io.netty.logging.InternalLoggerFactory;
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2012 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* <a href="http://en.wikipedia.org/wiki/New_I/O">NIO</a>-based channel
|
||||
* API implementation - recommended for a large number of connections (>= 1000).
|
||||
*/
|
||||
package io.netty.channel.nio;
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.oio;
|
||||
package io.netty.channel.oio;
|
||||
|
||||
import io.netty.buffer.BufType;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
@ -40,7 +40,7 @@ public abstract class AbstractOioByteChannel extends AbstractOioChannel {
|
||||
super(parent, id);
|
||||
}
|
||||
|
||||
boolean isInputShutdown() {
|
||||
protected boolean isInputShutdown() {
|
||||
return inputShutdown;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.oio;
|
||||
package io.netty.channel.oio;
|
||||
|
||||
import io.netty.channel.AbstractChannel;
|
||||
import io.netty.channel.Channel;
|
@ -13,14 +13,13 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.oio;
|
||||
package io.netty.channel.oio;
|
||||
|
||||
import io.netty.buffer.MessageBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
/**
|
||||
* Abstract base class for OIO which reads and writes objects from/to a Socket
|
||||
@ -34,16 +33,6 @@ public abstract class AbstractOioMessageChannel extends AbstractOioChannel {
|
||||
super(parent, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress localAddress() {
|
||||
return (InetSocketAddress) super.localAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress remoteAddress() {
|
||||
return (InetSocketAddress) super.remoteAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRead() {
|
||||
final ChannelPipeline pipeline = pipeline();
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.oio;
|
||||
package io.netty.channel.oio;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.oio;
|
||||
package io.netty.channel.oio;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFuture;
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.oio;
|
||||
package io.netty.channel.oio;
|
||||
|
||||
|
||||
import io.netty.channel.Channel;
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2012 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Old blocking I/O based channel API implementation - recommended for
|
||||
* a small number of connections (< 1000).
|
||||
*/
|
||||
package io.netty.channel.oio;
|
@ -20,12 +20,16 @@ import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelMetadata;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
import io.netty.channel.EventLoop;
|
||||
import io.netty.channel.aio.AbstractAioChannel;
|
||||
import io.netty.channel.aio.AioCompletionHandler;
|
||||
import io.netty.channel.aio.AioEventLoopGroup;
|
||||
import io.netty.channel.socket.ServerSocketChannel;
|
||||
import io.netty.channel.socket.ServerSocketChannelConfig;
|
||||
import io.netty.logging.InternalLogger;
|
||||
import io.netty.logging.InternalLoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.channels.AsynchronousChannelGroup;
|
||||
import java.nio.channels.AsynchronousCloseException;
|
||||
@ -77,6 +81,16 @@ public class AioServerSocketChannel extends AbstractAioChannel implements Server
|
||||
config = new AioServerSocketChannelConfig(this, channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress localAddress() {
|
||||
return (InetSocketAddress) super.localAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress remoteAddress() {
|
||||
return (InetSocketAddress) super.remoteAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AsynchronousServerSocketChannel javaChannel() {
|
||||
return (AsynchronousServerSocketChannel) super.javaChannel();
|
||||
@ -153,7 +167,8 @@ public class AioServerSocketChannel extends AbstractAioChannel implements Server
|
||||
protected Runnable doRegister() throws Exception {
|
||||
Runnable task = super.doRegister();
|
||||
if (ch == null) {
|
||||
AsynchronousServerSocketChannel channel = newSocket(((AioEventLoopGroup) eventLoop().parent()).group);
|
||||
AsynchronousServerSocketChannel channel =
|
||||
newSocket(((AioEventLoopGroup) eventLoop().parent()).channelGroup());
|
||||
ch = channel;
|
||||
config.assign(channel);
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
import io.netty.channel.EventLoop;
|
||||
import io.netty.channel.FileRegion;
|
||||
import io.netty.channel.aio.AbstractAioChannel;
|
||||
import io.netty.channel.aio.AioCompletionHandler;
|
||||
import io.netty.channel.aio.AioEventLoopGroup;
|
||||
import io.netty.channel.socket.ChannelInputShutdownEvent;
|
||||
import io.netty.channel.socket.ServerSocketChannel;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
@ -102,6 +105,16 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
||||
config = new DefaultAioSocketChannelConfig(this, ch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress localAddress() {
|
||||
return (InetSocketAddress) super.localAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress remoteAddress() {
|
||||
return (InetSocketAddress) super.remoteAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerSocketChannel parent() {
|
||||
return (ServerSocketChannel) super.parent();
|
||||
@ -201,7 +214,7 @@ public class AioSocketChannel extends AbstractAioChannel implements SocketChanne
|
||||
protected Runnable doRegister() throws Exception {
|
||||
super.doRegister();
|
||||
if (ch == null) {
|
||||
ch = newSocket(((AioEventLoopGroup) eventLoop().parent()).group);
|
||||
ch = newSocket(((AioEventLoopGroup) eventLoop().parent()).channelGroup());
|
||||
config.assign(javaChannel());
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelMetadata;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
import io.netty.channel.nio.AbstractNioMessageChannel;
|
||||
import io.netty.channel.socket.DatagramChannelConfig;
|
||||
import io.netty.channel.socket.DatagramPacket;
|
||||
import io.netty.channel.socket.InternetProtocolFamily;
|
||||
@ -268,6 +269,16 @@ public final class NioDatagramChannel
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress localAddress() {
|
||||
return (InetSocketAddress) super.localAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress remoteAddress() {
|
||||
return (InetSocketAddress) super.remoteAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelFuture joinGroup(InetAddress multicastAddress) {
|
||||
return joinGroup(multicastAddress, newPromise());
|
||||
|
@ -19,6 +19,7 @@ import io.netty.buffer.BufType;
|
||||
import io.netty.buffer.MessageBuf;
|
||||
import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelMetadata;
|
||||
import io.netty.channel.nio.AbstractNioMessageChannel;
|
||||
import io.netty.channel.socket.DefaultServerSocketChannelConfig;
|
||||
import io.netty.channel.socket.ServerSocketChannelConfig;
|
||||
|
||||
@ -57,6 +58,11 @@ public class NioServerSocketChannel extends AbstractNioMessageChannel
|
||||
config = new DefaultServerSocketChannelConfig(this, javaChannel().socket());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress localAddress() {
|
||||
return (InetSocketAddress) super.localAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelMetadata metadata() {
|
||||
return METADATA;
|
||||
|
@ -23,6 +23,7 @@ import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelMetadata;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
import io.netty.channel.EventLoop;
|
||||
import io.netty.channel.nio.AbstractNioByteChannel;
|
||||
import io.netty.channel.socket.DefaultSocketChannelConfig;
|
||||
import io.netty.channel.socket.ServerSocketChannel;
|
||||
import io.netty.channel.socket.SocketChannelConfig;
|
||||
@ -30,6 +31,7 @@ import io.netty.logging.InternalLogger;
|
||||
import io.netty.logging.InternalLoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.SocketChannel;
|
||||
@ -125,6 +127,16 @@ public class NioSocketChannel extends AbstractNioByteChannel implements io.netty
|
||||
return super.isInputShutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress localAddress() {
|
||||
return (InetSocketAddress) super.localAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress remoteAddress() {
|
||||
return (InetSocketAddress) super.remoteAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOutputShutdown() {
|
||||
return javaChannel().socket().isOutputShutdown() || !isActive();
|
||||
|
@ -26,6 +26,7 @@ import io.netty.channel.socket.DatagramChannel;
|
||||
import io.netty.channel.socket.DatagramChannelConfig;
|
||||
import io.netty.channel.socket.DatagramPacket;
|
||||
import io.netty.channel.socket.DefaultDatagramChannelConfig;
|
||||
import io.netty.channel.oio.AbstractOioMessageChannel;
|
||||
import io.netty.logging.InternalLogger;
|
||||
import io.netty.logging.InternalLoggerFactory;
|
||||
|
||||
@ -147,6 +148,16 @@ public class OioDatagramChannel extends AbstractOioMessageChannel
|
||||
socket.bind(localAddress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress localAddress() {
|
||||
return (InetSocketAddress) super.localAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress remoteAddress() {
|
||||
return (InetSocketAddress) super.remoteAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doConnect(SocketAddress remoteAddress,
|
||||
SocketAddress localAddress) throws Exception {
|
||||
|
@ -20,6 +20,7 @@ import io.netty.buffer.MessageBuf;
|
||||
import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelMetadata;
|
||||
import io.netty.channel.socket.ServerSocketChannel;
|
||||
import io.netty.channel.oio.AbstractOioMessageChannel;
|
||||
import io.netty.logging.InternalLogger;
|
||||
import io.netty.logging.InternalLoggerFactory;
|
||||
|
||||
@ -108,6 +109,11 @@ public class OioServerSocketChannel extends AbstractOioMessageChannel
|
||||
config = new DefaultOioServerSocketChannelConfig(this, socket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress localAddress() {
|
||||
return (InetSocketAddress) super.localAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelMetadata metadata() {
|
||||
return METADATA;
|
||||
|
@ -23,6 +23,7 @@ import io.netty.channel.ChannelPromise;
|
||||
import io.netty.channel.EventLoop;
|
||||
import io.netty.channel.socket.ServerSocketChannel;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.oio.OioByteStreamChannel;
|
||||
import io.netty.logging.InternalLogger;
|
||||
import io.netty.logging.InternalLoggerFactory;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.easymock.EasyMock.*;
|
@ -13,11 +13,12 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
import io.netty.channel.AbstractEventLoopTest;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.socket.ServerSocketChannel;
|
||||
import io.netty.channel.socket.aio.AioServerSocketChannel;
|
||||
|
||||
public class AioEventLoopTest extends AbstractEventLoopTest {
|
||||
@Override
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
public class ReflectiveAioChannelFinderTest extends AbstractAioChannelFinderTest {
|
||||
|
@ -13,7 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.aio;
|
||||
package io.netty.channel.aio;
|
||||
|
||||
public class UnsafeAioChannelFinderTest extends AbstractAioChannelFinderTest {
|
||||
|
@ -13,10 +13,12 @@
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package io.netty.channel.socket.nio;
|
||||
package io.netty.channel.nio;
|
||||
|
||||
import io.netty.channel.AbstractEventLoopTest;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import io.netty.channel.socket.ServerSocketChannel;
|
||||
|
||||
public class NioEventLoopTest extends AbstractEventLoopTest {
|
Loading…
x
Reference in New Issue
Block a user