Skip to content

Commit

Permalink
[ISSUE #7047] NettyRemotingClient#invokeOneway throw Exception with a…
Browse files Browse the repository at this point in the history
…ddress
  • Loading branch information
gaoyf authored Jul 20, 2023
1 parent 2c5808b commit ebad3c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ public void invokeOneway(String addr, RemotingCommand request, long timeoutMilli
}
} else {
this.closeChannel(addr, channel);
throw new RemotingConnectException(channelRemoteAddr);
throw new RemotingConnectException(addr);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.rocketmq.remoting.InvokeCallback;
import org.apache.rocketmq.remoting.exception.RemotingConnectException;
import org.apache.rocketmq.remoting.exception.RemotingException;
import org.apache.rocketmq.remoting.exception.RemotingSendRequestException;
import org.apache.rocketmq.remoting.exception.RemotingTimeoutException;
Expand Down Expand Up @@ -123,4 +124,14 @@ public void testRemotingException() throws Exception {
Throwable thrown = catchThrowable(future::get);
assertThat(thrown.getCause()).isInstanceOf(RemotingException.class);
}

@Test
public void testInvokeOnewayException() throws Exception {
String addr = "0.0.0.0";
try {
remotingClient.invokeOneway(addr, null, 1000);
} catch (RemotingConnectException e) {
assertThat(e.getMessage()).contains(addr);
}
}
}

0 comments on commit ebad3c8

Please sign in to comment.