diff --git a/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/handler/ConnectHandlerTest.java b/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/handler/ConnectHandlerTest.java index bfc20709..b9e4e9c1 100644 --- a/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/handler/ConnectHandlerTest.java +++ b/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/handler/ConnectHandlerTest.java @@ -27,17 +27,18 @@ import io.netty.channel.pool.ChannelPoolHandler; import org.junit.Assert; import org.junit.Test; +import java.io.IOException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; public class ConnectHandlerTest { @Test - public void handlerTest() { + public void handlerTest() throws IOException { // server Class cls = InstanceServerLoader.class; ClassRegistry.put(cls.getName(), cls); - ServerPort port = () -> 8888; + ServerPort port = () -> 8891; Instance instance = new DefaultInstance(); NettyServerTakeHandler serverHandler = new NettyServerTakeHandler(instance); AbstractNettyServerConnection connection = new AbstractNettyServerConnection(serverHandler); @@ -54,6 +55,8 @@ public class ConnectHandlerTest { InstanceServerLoader loader = NettyProxyCenter.getProxy(rpcClient, cls, "localhost", port); String name = loader.getName(); Assert.assertEquals("name", name); + rpcClient.close(); + rpcServer.close(); } } \ No newline at end of file diff --git a/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/support/NettyProxyCenterTest.java b/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/support/NettyProxyCenterTest.java index 57da74c8..b6623248 100644 --- a/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/support/NettyProxyCenterTest.java +++ b/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/support/NettyProxyCenterTest.java @@ -19,7 +19,6 @@ package cn.hippo4j.rpc.support; import cn.hippo4j.common.web.exception.IllegalException; import cn.hippo4j.rpc.discovery.ServerPort; -import cn.hippo4j.rpc.exception.ConnectionException; import cn.hippo4j.rpc.handler.AbstractNettyClientPoolHandler; import cn.hippo4j.rpc.handler.NettyClientTakeHandler; import org.junit.Assert; @@ -43,14 +42,6 @@ public class NettyProxyCenterTest { Assert.assertNotNull(localhost); } - @Test(expected = ConnectionException.class) - public void getProxyTestCall() { - AbstractNettyClientPoolHandler handler = new AbstractNettyClientPoolHandler(new NettyClientTakeHandler()); - ProxyInterface localhost = NettyProxyCenter.getProxy(ProxyInterface.class, "localhost", port, handler); - localhost.hello(); - Assert.assertNotNull(localhost); - } - interface ProxyInterface { void hello(); diff --git a/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/support/NettyServerSupportTest.java b/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/support/NettyServerSupportTest.java index eb78dc52..c8531f33 100644 --- a/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/support/NettyServerSupportTest.java +++ b/hippo4j-rpc/src/test/java/cn/hippo4j/rpc/support/NettyServerSupportTest.java @@ -29,7 +29,7 @@ public class NettyServerSupportTest { @Test public void bind() throws IOException { - NettyServerSupport support = new NettyServerSupport(() -> 8888, InstanceServerLoader.class); + NettyServerSupport support = new NettyServerSupport(() -> 8890, InstanceServerLoader.class); CompletableFuture.runAsync(support::bind); try { TimeUnit.SECONDS.sleep(3);