Updated serialization package. Updated RMI tests to include both network
connections and local connections.
This commit is contained in:
parent
efb7ef9770
commit
3aee8c93a7
23
test/dorkbox/network/rmi/Config.java
Normal file
23
test/dorkbox/network/rmi/Config.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright 2018 dorkbox, llc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package dorkbox.network.rmi;
|
||||
|
||||
import dorkbox.network.Configuration;
|
||||
|
||||
public
|
||||
interface Config {
|
||||
void apply(Configuration configuration);
|
||||
}
|
|
@ -4,8 +4,23 @@ package dorkbox.network.rmi;
|
|||
*
|
||||
*/
|
||||
public
|
||||
class MessageWithTestCow implements RmiMessages {
|
||||
class MessageWithTestCow {
|
||||
public int number;
|
||||
public String text;
|
||||
public TestCow testCow;
|
||||
private TestCow testCow;
|
||||
|
||||
private
|
||||
MessageWithTestCow() {
|
||||
// for kryo
|
||||
}
|
||||
|
||||
public
|
||||
MessageWithTestCow(final TestCow test) {
|
||||
testCow = test;
|
||||
}
|
||||
|
||||
public
|
||||
TestCow getTestCow() {
|
||||
return testCow;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ package dorkbox.network.rmi;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -49,6 +48,7 @@ import dorkbox.network.Configuration;
|
|||
import dorkbox.network.Server;
|
||||
import dorkbox.network.connection.Connection;
|
||||
import dorkbox.network.connection.ConnectionImpl;
|
||||
import dorkbox.network.connection.EndPointBase;
|
||||
import dorkbox.network.connection.Listener;
|
||||
import dorkbox.network.serialization.Serialization;
|
||||
import dorkbox.util.exceptions.InitializationException;
|
||||
|
@ -168,11 +168,11 @@ class RmiGlobalTest extends BaseTest {
|
|||
assertEquals(123.0F, slow, 0.0001D);
|
||||
|
||||
|
||||
// Test sending a reference to a remote object.
|
||||
MessageWithTestCow m = new MessageWithTestCow();
|
||||
// Test sending a reference to a remote object (the receiving end should receive the IMPL object, not the proxy object)
|
||||
MessageWithTestCow m = new MessageWithTestCow(test);
|
||||
m.number = 678;
|
||||
m.text = "sometext";
|
||||
m.testCow = test;
|
||||
|
||||
connection.send()
|
||||
.TCP(m)
|
||||
.flush();
|
||||
|
@ -189,11 +189,34 @@ class RmiGlobalTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public
|
||||
void rmi() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
Configuration configuration = new Configuration();
|
||||
void rmiNetwork() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
rmi(new Config() {
|
||||
@Override
|
||||
public
|
||||
void apply(final Configuration configuration) {
|
||||
configuration.tcpPort = tcpPort;
|
||||
configuration.udpPort = udpPort;
|
||||
configuration.host = host;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public
|
||||
void rmiLocal() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
rmi(new Config() {
|
||||
@Override
|
||||
public
|
||||
void apply(final Configuration configuration) {
|
||||
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public
|
||||
void rmi(final Config config) throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
Configuration configuration = new Configuration();
|
||||
config.apply(configuration);
|
||||
|
||||
configuration.serialization = Serialization.DEFAULT();
|
||||
register(configuration.serialization);
|
||||
|
@ -218,7 +241,6 @@ class RmiGlobalTest extends BaseTest {
|
|||
@Override
|
||||
public
|
||||
void connected(final Connection connection) {
|
||||
try {
|
||||
connection.getRemoteObject(CLIENT_GLOBAL_OBJECT_ID, new RemoteObjectCallback<TestCow>() {
|
||||
@Override
|
||||
public
|
||||
|
@ -228,17 +250,13 @@ class RmiGlobalTest extends BaseTest {
|
|||
@Override
|
||||
public
|
||||
void run() {
|
||||
System.err.println("Running test for: Server -> Client");
|
||||
System.err.println("Running test for: Server (LOCAL) -> Client (REMOTE)");
|
||||
runTest(connection, globalRemoteClientObject, remoteObject, CLIENT_GLOBAL_OBJECT_ID);
|
||||
System.err.println("Done with test for: Server -> Client");
|
||||
System.err.println("Done with test for: Server (LOCAL) -> Client (REMOTE)");
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -247,13 +265,13 @@ class RmiGlobalTest extends BaseTest {
|
|||
@Override
|
||||
public
|
||||
void received(Connection connection, MessageWithTestCow m) {
|
||||
System.err.println("Received finish signal for test for: Client -> Server");
|
||||
System.err.println("Received finish signal for test for: Client (LOCAL) -> Server (REMOTE)");
|
||||
|
||||
TestCow object = m.testCow;
|
||||
TestCow object = m.getTestCow();
|
||||
final int id = object.id();
|
||||
assertEquals(SERVER_GLOBAL_OBJECT_ID, id);
|
||||
|
||||
System.err.println("Finished test for: Client -> Server");
|
||||
System.err.println("Finished test for: Client (LOCAL) -> Server (REMOTE)");
|
||||
|
||||
stopEndPoints(2000);
|
||||
}
|
||||
|
@ -262,9 +280,7 @@ class RmiGlobalTest extends BaseTest {
|
|||
|
||||
// ----
|
||||
configuration = new Configuration();
|
||||
configuration.tcpPort = tcpPort;
|
||||
configuration.udpPort = udpPort;
|
||||
configuration.host = host;
|
||||
config.apply(configuration);
|
||||
|
||||
configuration.serialization = Serialization.DEFAULT();
|
||||
register(configuration.serialization);
|
||||
|
@ -290,16 +306,20 @@ class RmiGlobalTest extends BaseTest {
|
|||
@Override
|
||||
public
|
||||
void received(final Connection connection, MessageWithTestCow m) {
|
||||
System.err.println("Received finish signal for test for: Server -> Client");
|
||||
System.err.println("Received finish signal for test for: Server (LOCAL) -> Client (REMOTE)");
|
||||
|
||||
TestCow object = m.testCow;
|
||||
// this TestCow object should be the implementation, not the proxy.
|
||||
TestCow object = m.getTestCow();
|
||||
final int id = object.id();
|
||||
assertEquals(CLIENT_GLOBAL_OBJECT_ID, id);
|
||||
|
||||
System.err.println("Finished test for: Server -> Client");
|
||||
System.err.println("Finished test for: Server (LOCAL) -> Client (REMOTE)");
|
||||
|
||||
// connection.send()
|
||||
// .TCP(m)
|
||||
// .flush();
|
||||
|
||||
// normally this is in the 'connected', but we do it here, so that it's more linear and easier to debug
|
||||
try {
|
||||
connection.getRemoteObject(SERVER_GLOBAL_OBJECT_ID, new RemoteObjectCallback<TestCow>() {
|
||||
@Override
|
||||
public
|
||||
|
@ -309,17 +329,13 @@ class RmiGlobalTest extends BaseTest {
|
|||
@Override
|
||||
public
|
||||
void run() {
|
||||
System.err.println("Running test for: Client -> Server");
|
||||
System.err.println("Running test for: Client (LOCAL) -> Server (REMOTE)");
|
||||
runTest(connection, globalRemoteServerObject, remoteObject, SERVER_GLOBAL_OBJECT_ID);
|
||||
System.err.println("Done with test for: Client -> Server");
|
||||
System.err.println("Done with test for: Client (LOCAL) -> Server (REMOTE)");
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import dorkbox.network.Client;
|
|||
import dorkbox.network.Configuration;
|
||||
import dorkbox.network.Server;
|
||||
import dorkbox.network.connection.Connection;
|
||||
import dorkbox.network.connection.EndPointBase;
|
||||
import dorkbox.network.connection.Listener;
|
||||
import dorkbox.network.serialization.Serialization;
|
||||
import dorkbox.util.exceptions.InitializationException;
|
||||
|
@ -37,6 +38,31 @@ import dorkbox.util.exceptions.SecurityException;
|
|||
public
|
||||
class RmiSendObjectOverrideMethodTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public
|
||||
void rmiNetwork() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
rmi(new Config() {
|
||||
@Override
|
||||
public
|
||||
void apply(final Configuration configuration) {
|
||||
configuration.tcpPort = tcpPort;
|
||||
configuration.host = host;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public
|
||||
void rmiLocal() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
rmi(new Config() {
|
||||
@Override
|
||||
public
|
||||
void apply(final Configuration configuration) {
|
||||
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* In this test the server has two objects in an object space. The client
|
||||
* uses the first remote object to get the second remote object.
|
||||
|
@ -60,12 +86,10 @@ class RmiSendObjectOverrideMethodTest extends BaseTest {
|
|||
* The implType (if it exists, with the same name, and with the same signature + connection parameter) will be called from the interface
|
||||
* instead of the method that would NORMALLY be called.
|
||||
*/
|
||||
@Test
|
||||
public
|
||||
void rmi() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
void rmi(final Config config) throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
Configuration configuration = new Configuration();
|
||||
configuration.tcpPort = tcpPort;
|
||||
configuration.host = host;
|
||||
config.apply(configuration);
|
||||
|
||||
configuration.serialization = Serialization.DEFAULT();
|
||||
configuration.serialization.registerRmiImplementation(TestObject.class, TestObjectImpl.class);
|
||||
|
@ -97,8 +121,7 @@ class RmiSendObjectOverrideMethodTest extends BaseTest {
|
|||
|
||||
// ----
|
||||
configuration = new Configuration();
|
||||
configuration.tcpPort = tcpPort;
|
||||
configuration.host = host;
|
||||
config.apply(configuration);
|
||||
|
||||
configuration.serialization = Serialization.DEFAULT();
|
||||
configuration.serialization.registerRmiInterface(TestObject.class);
|
||||
|
@ -113,9 +136,8 @@ class RmiSendObjectOverrideMethodTest extends BaseTest {
|
|||
@Override
|
||||
public
|
||||
void connected(final Connection connection) {
|
||||
try {
|
||||
// if this is called in the dispatch thread, it will block network comms while waiting for a response and it won't work...
|
||||
connection.getRemoteObject(TestObject.class, new RemoteObjectCallback<TestObject>() {
|
||||
connection.createRemoteObject(TestObject.class, new RemoteObjectCallback<TestObject>() {
|
||||
@Override
|
||||
public
|
||||
void created(final TestObject remoteObject) {
|
||||
|
@ -150,11 +172,6 @@ class RmiSendObjectOverrideMethodTest extends BaseTest {
|
|||
}.start();
|
||||
}
|
||||
});
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ import dorkbox.network.Client;
|
|||
import dorkbox.network.Configuration;
|
||||
import dorkbox.network.Server;
|
||||
import dorkbox.network.connection.Connection;
|
||||
import dorkbox.network.connection.EndPointBase;
|
||||
import dorkbox.network.connection.Listener;
|
||||
import dorkbox.network.serialization.Serialization;
|
||||
import dorkbox.util.exceptions.InitializationException;
|
||||
|
@ -56,16 +57,39 @@ import dorkbox.util.exceptions.SecurityException;
|
|||
public
|
||||
class RmiSendObjectTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public
|
||||
void rmiNetwork() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
rmi(new Config() {
|
||||
@Override
|
||||
public
|
||||
void apply(final Configuration configuration) {
|
||||
configuration.tcpPort = tcpPort;
|
||||
configuration.host = host;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public
|
||||
void rmiLocal() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
rmi(new Config() {
|
||||
@Override
|
||||
public
|
||||
void apply(final Configuration configuration) {
|
||||
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* In this test the server has two objects in an object space. The client
|
||||
* uses the first remote object to get the second remote object.
|
||||
*/
|
||||
@Test
|
||||
public
|
||||
void rmi() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
void rmi(final Config config) throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
Configuration configuration = new Configuration();
|
||||
configuration.tcpPort = tcpPort;
|
||||
configuration.host = host;
|
||||
config.apply(configuration);
|
||||
|
||||
configuration.serialization = Serialization.DEFAULT();
|
||||
configuration.serialization.registerRmiImplementation(TestObject.class, TestObjectImpl.class);
|
||||
|
@ -99,8 +123,7 @@ class RmiSendObjectTest extends BaseTest {
|
|||
|
||||
// ----
|
||||
configuration = new Configuration();
|
||||
configuration.tcpPort = tcpPort;
|
||||
configuration.host = host;
|
||||
config.apply(configuration);
|
||||
|
||||
configuration.serialization = Serialization.DEFAULT();
|
||||
configuration.serialization.registerRmiInterface(TestObject.class);
|
||||
|
@ -116,8 +139,7 @@ class RmiSendObjectTest extends BaseTest {
|
|||
@Override
|
||||
public
|
||||
void connected(final Connection connection) {
|
||||
try {
|
||||
connection.getRemoteObject(TestObject.class, new RemoteObjectCallback<TestObject>() {
|
||||
connection.createRemoteObject(TestObject.class, new RemoteObjectCallback<TestObject>() {
|
||||
@Override
|
||||
public
|
||||
void created(final TestObject remoteObject) {
|
||||
|
@ -148,10 +170,6 @@ class RmiSendObjectTest extends BaseTest {
|
|||
}.start();
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ package dorkbox.network.rmi;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -48,6 +47,7 @@ import dorkbox.network.Client;
|
|||
import dorkbox.network.Configuration;
|
||||
import dorkbox.network.Server;
|
||||
import dorkbox.network.connection.Connection;
|
||||
import dorkbox.network.connection.EndPointBase;
|
||||
import dorkbox.network.connection.Listener;
|
||||
import dorkbox.network.connection.Listeners;
|
||||
import dorkbox.network.serialization.Serialization;
|
||||
|
@ -159,10 +159,9 @@ class RmiTest extends BaseTest {
|
|||
|
||||
|
||||
// Test sending a reference to a remote object.
|
||||
MessageWithTestCow m = new MessageWithTestCow();
|
||||
MessageWithTestCow m = new MessageWithTestCow(test);
|
||||
m.number = 678;
|
||||
m.text = "sometext";
|
||||
m.testCow = test;
|
||||
connection.send()
|
||||
.TCP(m)
|
||||
.flush();
|
||||
|
@ -179,11 +178,45 @@ class RmiTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public
|
||||
void rmi() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
Configuration configuration = new Configuration();
|
||||
void rmiNetwork() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
rmi(new Config() {
|
||||
@Override
|
||||
public
|
||||
void apply(final Configuration configuration) {
|
||||
configuration.tcpPort = tcpPort;
|
||||
configuration.udpPort = udpPort;
|
||||
configuration.host = host;
|
||||
}
|
||||
});
|
||||
|
||||
// have to reset the object ID counter
|
||||
TestCowImpl.ID_COUNTER.set(1);
|
||||
|
||||
Thread.sleep(2000L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public
|
||||
void rmiLocal() throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
rmi(new Config() {
|
||||
@Override
|
||||
public
|
||||
void apply(final Configuration configuration) {
|
||||
configuration.localChannelName = EndPointBase.LOCAL_CHANNEL;
|
||||
}
|
||||
});
|
||||
|
||||
// have to reset the object ID counter
|
||||
TestCowImpl.ID_COUNTER.set(1);
|
||||
|
||||
Thread.sleep(2000L);
|
||||
}
|
||||
|
||||
|
||||
public
|
||||
void rmi(final Config config) throws InitializationException, SecurityException, IOException, InterruptedException {
|
||||
Configuration configuration = new Configuration();
|
||||
config.apply(configuration);
|
||||
|
||||
configuration.serialization = Serialization.DEFAULT();
|
||||
register(configuration.serialization);
|
||||
|
@ -208,7 +241,7 @@ class RmiTest extends BaseTest {
|
|||
void received(final Connection connection, MessageWithTestCow m) {
|
||||
System.err.println("Received finish signal for test for: Client -> Server");
|
||||
|
||||
TestCow object = m.testCow;
|
||||
TestCow object = m.getTestCow();
|
||||
final int id = object.id();
|
||||
assertEquals(1, id);
|
||||
System.err.println("Finished test for: Client -> Server");
|
||||
|
@ -217,9 +250,8 @@ class RmiTest extends BaseTest {
|
|||
System.err.println("Starting test for: Server -> Client");
|
||||
|
||||
// normally this is in the 'connected', but we do it here, so that it's more linear and easier to debug
|
||||
try {
|
||||
// if this is called in the dispatch thread, it will block network comms while waiting for a response and it won't work...
|
||||
connection.getRemoteObject(TestCow.class, new RemoteObjectCallback<TestCow>() {
|
||||
connection.createRemoteObject(TestCow.class, new RemoteObjectCallback<TestCow>() {
|
||||
@Override
|
||||
public
|
||||
void created(final TestCow remoteObject) {
|
||||
|
@ -235,19 +267,13 @@ class RmiTest extends BaseTest {
|
|||
}.start();
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// ----
|
||||
configuration = new Configuration();
|
||||
configuration.tcpPort = tcpPort;
|
||||
configuration.udpPort = udpPort;
|
||||
configuration.host = host;
|
||||
config.apply(configuration);
|
||||
|
||||
configuration.serialization = Serialization.DEFAULT();
|
||||
register(configuration.serialization);
|
||||
|
@ -271,9 +297,8 @@ class RmiTest extends BaseTest {
|
|||
void connected(final Connection connection) {
|
||||
System.err.println("Starting test for: Client -> Server");
|
||||
|
||||
try {
|
||||
// if this is called in the dispatch thread, it will block network comms while waiting for a response and it won't work...
|
||||
connection.getRemoteObject(TestCow.class, new RemoteObjectCallback<TestCow>() {
|
||||
connection.createRemoteObject(TestCow.class, new RemoteObjectCallback<TestCow>() {
|
||||
@Override
|
||||
public
|
||||
void created(final TestCow remoteObject) {
|
||||
|
@ -289,10 +314,6 @@ class RmiTest extends BaseTest {
|
|||
}.start();
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -303,7 +324,7 @@ class RmiTest extends BaseTest {
|
|||
void received(Connection connection, MessageWithTestCow m) {
|
||||
System.err.println("Received finish signal for test for: Client -> Server");
|
||||
|
||||
TestCow object = m.testCow;
|
||||
TestCow object = m.getTestCow();
|
||||
final int id = object.id();
|
||||
assertEquals(2, id);
|
||||
System.err.println("Finished test for: Client -> Server");
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
package dorkbox.network.rmi;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public
|
||||
class TestCowBaseImpl implements TestCowBase {
|
||||
// has to start at 1, because UDP method invocations ignore return values
|
||||
static final AtomicInteger ID_COUNTER = new AtomicInteger(1);
|
||||
|
||||
public
|
||||
TestCowBaseImpl() {
|
||||
}
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
package dorkbox.network.rmi;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public
|
||||
class TestCowImpl extends TestCowBaseImpl implements TestCow {
|
||||
// has to start at 1, because UDP method invocations ignore return values
|
||||
static final AtomicInteger ID_COUNTER = new AtomicInteger(1);
|
||||
|
||||
private int moos;
|
||||
private final int id = ID_COUNTER.getAndIncrement();
|
||||
|
||||
|
@ -23,14 +28,14 @@ class TestCowImpl extends TestCowBaseImpl implements TestCow {
|
|||
public
|
||||
void moo(String value) {
|
||||
this.moos += 2;
|
||||
System.out.println("Moo! " + this.moos + " :" + value);
|
||||
System.out.println("Moo! " + this.moos + ": " + value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public
|
||||
void moo(String value, long delay) {
|
||||
this.moos += 4;
|
||||
System.out.println("Moo! " + this.moos + " :" + value + " (" + delay + ")");
|
||||
System.out.println("Moo! " + this.moos + ": " + value + " (" + delay + ")");
|
||||
try {
|
||||
Thread.sleep(delay);
|
||||
} catch (InterruptedException e) {
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package dorkbox.network.rmi.multiJVM;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
|
@ -98,9 +94,8 @@ class TestClient
|
|||
void connected(final Connection connection) {
|
||||
System.err.println("Starting test for: Client -> Server");
|
||||
|
||||
try {
|
||||
// if this is called in the dispatch thread, it will block network comms while waiting for a response and it won't work...
|
||||
connection.getRemoteObject(TestCow.class, new RemoteObjectCallback<TestCow>() {
|
||||
connection.createRemoteObject(TestCow.class, new RemoteObjectCallback<TestCow>() {
|
||||
@Override
|
||||
public
|
||||
void created(final TestCow remoteObject) {
|
||||
|
@ -123,10 +118,6 @@ class TestClient
|
|||
}.start();
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user