use of java.net.SocketException in project robovm by robovm.
the class OldServerSocketTest method test_setReceiveBufferSizeI.
public void test_setReceiveBufferSizeI() throws IOException {
ServerSocket newSocket = new ServerSocket();
newSocket.close();
try {
newSocket.setReceiveBufferSize(10);
fail("SocketException was not thrown.");
} catch (SocketException se) {
//expected
}
}
use of java.net.SocketException in project robovm by robovm.
the class OldServerSocketTest method test_setReuseAddressZ.
public void test_setReuseAddressZ() throws IOException {
ServerSocket newSocket = new ServerSocket();
newSocket.close();
try {
newSocket.setReuseAddress(true);
fail("SocketException was not thrown.");
} catch (SocketException expected) {
}
}
use of java.net.SocketException in project robovm by robovm.
the class OldSocketImplFactoryTest method test_createSocketImpl.
public void test_createSocketImpl() throws IOException {
MockSocketImplFactory factory = new MockSocketImplFactory();
if (isTestable) {
assertFalse(isCreateSocketImpl);
Socket.setSocketImplFactory(factory);
try {
new Socket();
assertTrue(isCreateSocketImpl);
assertTrue(iSocketImplCalled);
} catch (Exception e) {
fail("Exception during test : " + e.getMessage());
}
try {
Socket.setSocketImplFactory(factory);
fail("SocketException was not thrown.");
} catch (SocketException se) {
//expected
}
try {
Socket.setSocketImplFactory(null);
fail("SocketException was not thrown.");
} catch (SocketException se) {
//expected
}
} else {
SocketImpl si = factory.createSocketImpl();
try {
assertNull(si.getOption(0));
} catch (SocketException e) {
fail("SocketException was thrown.");
}
}
}
use of java.net.SocketException in project robovm by robovm.
the class OldSocketTest method test_setSendBufferSizeI.
public void test_setSendBufferSizeI() {
try {
int sport = startServer("SServer setSendBufferSizeI");
s = new Socket(InetAddress.getLocalHost(), sport, null, 0);
s.setSendBufferSize(134);
assertTrue("Incorrect buffer size", s.getSendBufferSize() >= 134);
ensureExceptionThrownIfOptionIsUnsupportedOnOS(SO_SNDBUF);
} catch (Exception e) {
handleException(e, SO_SNDBUF);
}
try {
Socket theSocket = new Socket();
theSocket.close();
theSocket.setSendBufferSize(1);
fail("SocketException was not thrown.");
} catch (SocketException ioe) {
//expected
} catch (IOException ioe) {
fail("IOException was thrown.");
}
}
use of java.net.SocketException in project robovm by robovm.
the class OldSocketTest method test_setTcpNoDelayZ.
public void test_setTcpNoDelayZ() {
// Test for method void java.net.Socket.setTcpNoDelay(boolean)
try {
int sport = startServer("SServer setTcpNoDelayZ");
s = new Socket(InetAddress.getLocalHost(), sport, null, 0);
boolean bool;
s.setTcpNoDelay(bool = !s.getTcpNoDelay());
assertTrue("Failed to set no delay setting: " + s.getTcpNoDelay(), s.getTcpNoDelay() == bool);
ensureExceptionThrownIfOptionIsUnsupportedOnOS(TCP_NODELAY);
} catch (Exception e) {
handleException(e, TCP_NODELAY);
}
try {
Socket theSocket = new Socket();
theSocket.close();
theSocket.setTcpNoDelay(true);
fail("SocketException was not thrown.");
} catch (SocketException ioe) {
//expected
} catch (IOException ioe) {
fail("IOException was thrown.");
}
}
Aggregations