barchart / barchart-udt

Java wrapper for native C++ UDT protocol.
https://github.com/barchart/barchart-udt/wiki
128 stars 89 forks source link

AbstractMethodError when get the address #45

Closed He-Pin closed 11 years ago

He-Pin commented 11 years ago

Hi ,i always get this issue when i was trying to get the remote socket address ,I reported this issue before

Exception in thread "udt client socket reader" java.lang.AbstractMethodError: java.nio.channels.SocketChannel.getRemoteAddress()Ljava/net/SocketAddress;
    at us.sosia.net.client.relay.RelayClient$1.onMessageReceved(RelayClient.java:49)
    at us.sosia.net.udt.channel.DataWorker.readData(DataWorker.java:113)
    at us.sosia.net.udt.channel.DataWorker.access$0(DataWorker.java:74)
    at us.sosia.net.udt.channel.DataWorker$2.run(DataWorker.java:151)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

I using it as this :

    @Override
            public void onMessageReceved(SocketChannel socketChannel,
                    ByteBuffer byteBuffer) {
                try {
                    System.out.println("message received :"+socketChannel.getRemoteAddress());
                } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }

                super.onMessageReceved(socketChannel, byteBuffer);
            }

I haven't try this in netty 4,the version is barchart 2.2.2

He-Pin commented 11 years ago

update: When I test the code with the netty4,it works grate .it seems like when i cast up an SocketChannelUDT to an SocketChannel,will cause this problem .Will reopen If i encounter this problem in the recently release.