本文整理汇总了Java中java.rmi.UnknownHostException类的典型用法代码示例。如果您正苦于以下问题:Java UnknownHostException类的具体用法?Java UnknownHostException怎么用?Java UnknownHostException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnknownHostException类属于java.rmi包,在下文中一共展示了UnknownHostException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClientConnection
import java.rmi.UnknownHostException; //导入依赖的package包/类
static final AbstractClientConnection getClientConnection(Endpoint ep)
throws IOException, UnknownHostException, ConnectException,
ConnectIOException {
Socket sock = null;
AbstractClientConnection ret;
RMIClientSocketFactory csf = (ep.getCsf() != null) ? ep.getCsf()
: RMISocketFactory.getSocketFactory();
if (csf == null) {
csf = RMISocketFactory.getDefaultSocketFactory();
}
sock = csf.createSocket(ep.getEndpointID().getHost(), ep.getPort());
if (SO_TIME_OUT != 0) {
sock.setSoTimeout(SO_TIME_OUT);
}
sock.setTcpNoDelay(true);
if (sock instanceof HttpSocketClientSide) {
ret = new SingleOpClientConnection(sock, ep);
} else {
ret = new StreamClientConnection(sock, ep);
}
return ret;
}
示例2: retryRequest
import java.rmi.UnknownHostException; //导入依赖的package包/类
@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
if (executionCount >= 3) {
logger.info("Got too many exceptions");
// Do not retry if over max retry count
return false;
}
if (exception instanceof InterruptedIOException) {
// Timeout
logger.info("Got interrupted exception");
return true;
}
if (exception instanceof SocketException)
{
logger.info("Got socket exception");
return true;
}
if (exception instanceof org.apache.http.NoHttpResponseException){
logger.warn("got no http response exception");
return true;
}
if (exception instanceof UnknownHostException) {
// Unknown host
return false;
}
if (exception instanceof ConnectTimeoutException) {
// Connection refused
return true;
}
if (exception instanceof SSLException) {
// SSL handshake exception
return false;
}
HttpClientContext clientContext = HttpClientContext.adapt(context);
HttpRequest request = clientContext.getRequest();
boolean idempotent = !(request instanceof HttpEntityEnclosingRequest);
if (idempotent) {
// Retry if the request is considered idempotent
return true;
}
return false;
}
示例3: isLocalProblem
import java.rmi.UnknownHostException; //导入依赖的package包/类
public static boolean isLocalProblem(RemoteException e) {
if (e instanceof ConnectIOException) {
return true;
} else if (e instanceof ConnectException) {
return true;
} else if (e instanceof UnknownHostException) {
return true;
}
return false;
}
示例4: createNetSocket
import java.rmi.UnknownHostException; //导入依赖的package包/类
/** @see NetLayer#createNetSocket(Map, NetAddress, NetAddress) */
@Override
public NetSocket createNetSocket(final Map<String, Object> localProperties,
final NetAddress localAddress,
final NetAddress remoteAddress)
throws IOException
{
final TcpipNetAddress r = (TcpipNetAddress) remoteAddress;
// read (optional) properties
final Integer timeoutInMs = PropertiesUtil.getAsInteger(localProperties, TIMEOUT_IN_MS, DEFAULT_TIMEOUT);
// create connection and open socket
final Socket socket = SocketGlobalUtil.createOriginalSocket();
/*if (r.getIpaddress() != null)
{
final InetAddress remoteInetAddress = InetAddress.getByAddress(r.getIpaddress());
final InetSocketAddress remoteInetSocketAddress = new InetSocketAddress(remoteInetAddress, r.getPort());
socket.connect(remoteInetSocketAddress, timeoutInMs);
}
else
{ */
// use host name
final InetSocketAddress remoteInetSocketAddress = new InetSocketAddress(r.getHostname(), r.getPort());
if (remoteInetSocketAddress.getAddress() == null)
{
throw new UnknownHostException("hostlookup didnt worked. for Hostname : " + r.getHostname());
}
socket.connect(remoteInetSocketAddress, timeoutInMs);
//}
// convert and return result
return new Socket2NetSocket(socket);
}
示例5: launchGui
import java.rmi.UnknownHostException; //导入依赖的package包/类
private static void launchGui()
{
String args[] = { "localhost" , "59125" };
try
{
MaryGUIClient.main(args);
}
catch (UnknownHostException uhe) { Log.print(uhe); }
catch (IOException ioe) { Log.print(ioe); }
catch (Exception e) { Log.print(e); }
}
示例6: testUnknownHostExceptionStringException
import java.rmi.UnknownHostException; //导入依赖的package包/类
/**
* {@link java.rmi.UnknownHostException#UnknownHostException(java.lang.String, java.lang.Exception)}.
*/
public void testUnknownHostExceptionStringException() {
NullPointerException npe = new NullPointerException();
UnknownHostException e = new UnknownHostException("fixture", npe);
assertTrue(e.getMessage().indexOf("fixture") > -1);
assertSame(npe, e.getCause());
assertSame(npe, e.detail);
}
示例7: testUnknownHostExceptionString
import java.rmi.UnknownHostException; //导入依赖的package包/类
/**
* {@link java.rmi.UnknownHostException#UnknownHostException(java.lang.String)}.
*/
public void testUnknownHostExceptionString() {
UnknownHostException e = new UnknownHostException("fixture");
assertEquals("fixture", e.getMessage());
assertNull(e.getCause());
assertNull(e.detail);
}
示例8: rmiProxyFactoryBeanWithUnknownHostException
import java.rmi.UnknownHostException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithUnknownHostException() throws Exception {
doTestRmiProxyFactoryBeanWithException(UnknownHostException.class);
}
示例9: rmiProxyFactoryBeanWithUnknownHostExceptionAndRefresh
import java.rmi.UnknownHostException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithUnknownHostExceptionAndRefresh() throws Exception {
doTestRmiProxyFactoryBeanWithExceptionAndRefresh(UnknownHostException.class);
}
示例10: rmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostException
import java.rmi.UnknownHostException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostException() throws Exception {
doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException(
UnknownHostException.class, RemoteConnectFailureException.class);
}
示例11: rmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostExceptionAndRefresh
import java.rmi.UnknownHostException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostExceptionAndRefresh() throws Exception {
doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh(
UnknownHostException.class, RemoteConnectFailureException.class);
}
示例12: testRmiProxyFactoryBeanWithUnknownHostException
import java.rmi.UnknownHostException; //导入依赖的package包/类
public void testRmiProxyFactoryBeanWithUnknownHostException() throws Exception {
doTestRmiProxyFactoryBeanWithException(UnknownHostException.class);
}
示例13: testRmiProxyFactoryBeanWithUnknownHostExceptionAndRefresh
import java.rmi.UnknownHostException; //导入依赖的package包/类
public void testRmiProxyFactoryBeanWithUnknownHostExceptionAndRefresh() throws Exception {
doTestRmiProxyFactoryBeanWithExceptionAndRefresh(UnknownHostException.class);
}
示例14: testRmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostException
import java.rmi.UnknownHostException; //导入依赖的package包/类
public void testRmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostException() throws Exception {
doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException(
UnknownHostException.class, RemoteConnectFailureException.class);
}
示例15: testRmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostExceptionAndRefresh
import java.rmi.UnknownHostException; //导入依赖的package包/类
public void testRmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostExceptionAndRefresh() throws Exception {
doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh(
UnknownHostException.class, RemoteConnectFailureException.class);
}