1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.handler.codec.embedder;
17
18 import java.net.SocketAddress;
19
20 import org.jboss.netty.channel.AbstractChannel;
21 import org.jboss.netty.channel.ChannelConfig;
22 import org.jboss.netty.channel.ChannelPipeline;
23 import org.jboss.netty.channel.ChannelSink;
24 import org.jboss.netty.channel.DefaultChannelConfig;
25
26
27
28
29
30
31 class EmbeddedChannel extends AbstractChannel {
32
33 private static final Integer DUMMY_ID = 0;
34
35 private final ChannelConfig config;
36 private final SocketAddress localAddress = new EmbeddedSocketAddress();
37 private final SocketAddress remoteAddress = new EmbeddedSocketAddress();
38
39 EmbeddedChannel(ChannelPipeline pipeline, ChannelSink sink) {
40 super(DUMMY_ID, null, EmbeddedChannelFactory.INSTANCE, pipeline, sink);
41 config = new DefaultChannelConfig();
42 }
43
44 public ChannelConfig getConfig() {
45 return config;
46 }
47
48 public SocketAddress getLocalAddress() {
49 return localAddress;
50 }
51
52 public SocketAddress getRemoteAddress() {
53 return remoteAddress;
54 }
55
56 public boolean isBound() {
57 return true;
58 }
59
60 public boolean isConnected() {
61 return true;
62 }
63 }