我们的服务器运行正常,以下是我们代码的基本版本:
MessageFactory<IsoMessage> messageFactory = ConfigParser.createDefault();
Iso8583Client<IsoMessage> client = new Iso8583Client< (socketAddress,ClientConfiguration.getDefault(),messageFactory);
client.addMessageListener(new IsoMessageListener<IsoMessage>() {
@Override
public boolean applies(IsoMessage arg0) {
return false;
}
@Override
public boolean onMessage(ChannelHandlerContext arg0, IsoMessage arg1) {
return false;
}
});
client.getConfiguration().setReplyOnError(true);
client.init();
EventLoopGroup group = new NioEventLoopGroup();
try {
client.connect("127.0.0.1", 8080);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
System.out.println("Problem in client Connection");
e.printStackTrace();
}
我收到以下错误,请帮助:
线程“main”中的异常java.lang.IllegalStateException:未设置remoteAddress 在io.netty.bootstrap.Bootstrap.connect(Bootstrap.java:116) 在com.github.kpavlov.jreactive8583.client.Iso8583Client.connectAsync(Iso8583Client.java:88) 在com.github.kpavlov.jreactive8583.client.Iso8583Client.connect(Iso8583Client.java:48) 在com.github.kpavlov.jreactive8583.client.Iso8583Client.connect(Iso8583Client.java:75) at com.github.kpavlov.jreactive8583.client.Iso8583Client.connect(Iso8583Client.java:63) 在com.tushar.jreactive8583.demo_iso8385.AppClient.main(AppClient.java:62)
答案 0 :(得分:1)
替换
Iso8583Client<IsoMessage> client = new Iso8583Client<>(messageFactory);
用
SocketAddress socketAddress = new InetSocketAddress("127.0.0.1", 8080);
Iso8583Client<IsoMessage> client = new Iso8583Client<>(socketAddress, messageFactory);