java类java.net.UnknownServiceException的实例源码

CallTest.java 文件源码 项目:GitHub 阅读 31 收藏 0 点赞 0 评论 0
@Test public void cleartextCallsFailWhenCleartextIsDisabled() throws Exception {
  // Configure the client with only TLS configurations. No cleartext!
  client = client.newBuilder()
      .connectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS, ConnectionSpec.COMPATIBLE_TLS))
      .build();

  server.enqueue(new MockResponse());

  Request request = new Request.Builder().url(server.url("/")).build();
  try {
    client.newCall(request).execute();
    fail();
  } catch (UnknownServiceException expected) {
    assertEquals("CLEARTEXT communication not enabled for client", expected.getMessage());
  }
}
CallTest.java 文件源码 项目:GitHub 阅读 27 收藏 0 点赞 0 评论 0
@Test public void cleartextCallsFailWhenCleartextIsDisabled() throws Exception {
  // Configure the client with only TLS configurations. No cleartext!
  client = client.newBuilder()
      .connectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS, ConnectionSpec.COMPATIBLE_TLS))
      .build();

  server.enqueue(new MockResponse());

  Request request = new Request.Builder().url(server.url("/")).build();
  try {
    client.newCall(request).execute();
    fail();
  } catch (UnknownServiceException expected) {
    assertEquals("CLEARTEXT communication not enabled for client", expected.getMessage());
  }
}
FileURL.java 文件源码 项目:incubator-netbeans 阅读 15 收藏 0 点赞 0 评论 0
public InputStream getInputStream() throws IOException, UnknownServiceException {
    connect();

    if (iStream == null) {
        try {
            if (fo.isFolder()) {
                iStream = new FIS(fo);
            } else {
                iStream = fo.getInputStream();
            }
        } catch (FileNotFoundException e) {
            ExternalUtil.exception(e);
            throw e;
        }
    }

    return iStream;
}
GsonResponseBodyConverter.java 文件源码 项目:XSnow 阅读 16 收藏 0 点赞 0 评论 0
@Override
public T convert(@NonNull ResponseBody value) throws IOException {
    if (adapter != null && gson != null) {
        JsonReader jsonReader = gson.newJsonReader(value.charStream());
        try {
            T data = adapter.read(jsonReader);
            if (data == null) throw new UnknownServiceException("server back data is null");
            if (data instanceof ApiResult) {
                ApiResult apiResult = (ApiResult) data;
                if (!ResponseHelper.isSuccess(apiResult)) {
                    throw new UnknownServiceException(apiResult.getMsg() == null ? "unknow error" : apiResult.getMsg());
                }
            }
            return data;
        } finally {
            value.close();
        }
    } else {
        return null;
    }
}
GsonResponseBodyConverter.java 文件源码 项目:AndroidBasicLibs 阅读 14 收藏 0 点赞 0 评论 0
@Override
public T convert(ResponseBody value) throws IOException {
    if (adapter != null && gson != null) {
        JsonReader jsonReader = gson.newJsonReader(value.charStream());
        try {
            T data = adapter.read(jsonReader);
            if (data == null) throw new UnknownServiceException("server back data is null");
            if (data instanceof ApiResult) {
                ApiResult apiResult = (ApiResult) data;
                if (!ApiException.isSuccess(apiResult)) {
                    throw new UnknownServiceException(apiResult.getMsg() == null ? "unknow error" : apiResult.getMsg());
                }
            }
            return data;
        } finally {
            value.close();
        }
    } else {
        return null;
    }
}
ConnectionSpecSelector.java 文件源码 项目:boohee_v5.6 阅读 24 收藏 0 点赞 0 评论 0
public ConnectionSpec configureSecureSocket(SSLSocket sslSocket) throws IOException {
    ConnectionSpec tlsConfiguration = null;
    int size = this.connectionSpecs.size();
    for (int i = this.nextModeIndex; i < size; i++) {
        ConnectionSpec connectionSpec = (ConnectionSpec) this.connectionSpecs.get(i);
        if (connectionSpec.isCompatible(sslSocket)) {
            tlsConfiguration = connectionSpec;
            this.nextModeIndex = i + 1;
            break;
        }
    }
    if (tlsConfiguration == null) {
        throw new UnknownServiceException("Unable to find acceptable protocols. isFallback="
                + this.isFallback + ", modes=" + this.connectionSpecs + ", supported " +
                "protocols=" + Arrays.toString(sslSocket.getEnabledProtocols()));
    }
    this.isFallbackPossible = isFallbackPossible(sslSocket);
    Internal.instance.apply(tlsConfiguration, sslSocket, this.isFallback);
    return tlsConfiguration;
}
GsonResponseBodyConverter.java 文件源码 项目:SuperHttp 阅读 13 收藏 0 点赞 0 评论 0
@Override
public T convert(@NonNull ResponseBody value) throws IOException {
    if (adapter != null && gson != null) {
        JsonReader jsonReader = gson.newJsonReader(value.charStream());
        try {
            T data = adapter.read(jsonReader);
            if (data == null) throw new UnknownServiceException("server back data is null");
            if (data instanceof ApiResult) {
                ApiResult apiResult = (ApiResult) data;
                if (!ResponseHelper.isSuccess(apiResult)) {
                    throw new UnknownServiceException(apiResult.getMsg() == null ? "unknow error" : apiResult.getMsg());
                }
            }
            return data;
        } finally {
            value.close();
        }
    } else {
        return null;
    }
}
CallTest.java 文件源码 项目:PriorityOkHttp 阅读 28 收藏 0 点赞 0 评论 0
@Test public void cleartextCallsFailWhenCleartextIsDisabled() throws Exception {
  // Configure the client with only TLS configurations. No cleartext!
  client = client.newBuilder()
      .connectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS, ConnectionSpec.COMPATIBLE_TLS))
      .build();

  server.enqueue(new MockResponse());

  Request request = new Request.Builder().url(server.url("/")).build();
  try {
    client.newCall(request).execute();
    fail();
  } catch (UnknownServiceException expected) {
    assertTrue(expected.getMessage().contains("CLEARTEXT communication not supported"));
  }
}
MediathekListFragment.java 文件源码 项目:zapp 阅读 16 收藏 0 点赞 0 评论 0
@Override
public void onFailure(@NonNull Call<MediathekAnswer> call, @NonNull Throwable t) {
    adapter.setLoading(false);
    swipeRefreshLayout.setRefreshing(false);

    if (!call.isCanceled()) {
        // ignore canceled calls, because it most likely was canceled by app code
        Timber.e(t);

        if (t instanceof SSLHandshakeException || t instanceof UnknownServiceException) {
            showError(R.string.error_mediathek_ssl_error);
        } else {
            showError(R.string.error_mediathek_info_not_available);
        }
    }
}
CallTest.java 文件源码 项目:Okhttp 阅读 26 收藏 0 点赞 0 评论 0
@Test public void cleartextCallsFailWhenCleartextIsDisabled() throws Exception {
  // Configure the client with only TLS configurations. No cleartext!
  client = client.newBuilder()
      .connectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS, ConnectionSpec.COMPATIBLE_TLS))
      .build();

  server.enqueue(new MockResponse());

  Request request = new Request.Builder().url(server.url("/")).build();
  try {
    client.newCall(request).execute();
    fail();
  } catch (UnknownServiceException expected) {
    assertEquals("CLEARTEXT communication not enabled for client", expected.getMessage());
  }
}
RtspURLConnection.java 文件源码 项目:RTSP-Java-UrlConnection 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Sets the supported RTSP method by the server
 * 
 * @throws IOException
 */
protected void setSupportedMethods() throws IOException {
    options();
    if (isSuccessfullResponse()) {
        String pub = responses.findValue("Public");
        if (pub != null) {
            StringTokenizer st = new StringTokenizer(pub, ",");
            if (st.countTokens() > 0) {
                List<String> l = new ArrayList<String>();
                l.add(OPTIONS);
                String s;
                while (st.hasMoreTokens()) {
                    s = st.nextToken().trim();
                    if (Arrays.binarySearch(getPlatformPossibleMethods(), s) >= 0) {
                        Debug.println(" ADD SRV METHOD " + s);
                        l.add(s);
                    }
                }
                this.supportedMethods = l.toArray(new String[l.size()]);
                return;
            }
        }
    }
    throw new UnknownServiceException("Cannot retreive server supported rtsp methods.");
}
OAuthClient.java 文件源码 项目:bitbucket-api-client-java 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Returns an authorized Bitbucket API service.
 * @param authorizationCode authorization code received by the redirection
 * endpoint
 * @return authorized Bitbucket API service
 * @throws IOException if an I/O exception has occurred
 * @throws NullPointerException if this object has no client credentials
 * @since 5.0
 */
public Service getService(String authorizationCode)
        throws IOException {
    AuthorizationCodeFlow flow = getAuthorizationCodeFlow(true);
    AuthorizationCodeTokenRequest request
            = flow.newTokenRequest(authorizationCode);
    if (redirectionEndpointUri != null) {
        request.setRedirectUri(redirectionEndpointUri);
    }

    TokenResponse tokenResponse = request.execute();
    String tokenType = tokenResponse.getTokenType();
    if (!tokenType.equals(BEARER_TOKEN_TYPE)) {
        throw new UnknownServiceException("Unsupported token type");
    }
    return new RestService(
            flow.createAndStoreCredential(tokenResponse, getUser()));
}
QEmuProcess.java 文件源码 项目:qemu-java 阅读 20 收藏 0 点赞 0 评论 0
/**
 * @throws NoRouteToHostException if the process is terminated.
 * @throws UnknownServiceException if the process has no known monitor address.
 */
@Nonnull
public QApiConnection getConnection() throws IOException {
    if (monitor == null)
        throw new UnknownServiceException("No monitor address known.");

    try {
        // If this succeeds, then we have exited.
        int exitValue = process.exitValue();
        connection = null;
        throw new NoRouteToHostException("Process terminated with exit code " + exitValue);
    } catch (IllegalThreadStateException e) {
    }

    synchronized (lock) {
        if (connection != null)
            return connection;
        connection = new QApiConnection(monitor);
        return connection;
    }
}
VRLConnection.java 文件源码 项目:vbrowser 阅读 15 收藏 0 点赞 0 评论 0
public InputStream getInputStream() throws IOException
{
    if (this.connected == false)
        connect();

    if (node instanceof VStreamReadable)
    {
        return ((VStreamReadable) node).createInputStream();
    }
    else if (node instanceof VDir)
    {
        // Directories do not have stream read methods.
        // possibly the 'index.html' file is meant, but
        // here we don't know what the caller wants.
        throw new UnknownServiceException("VRS: Location is a directory:" + node);
    }
    else
    {
        throw new UnknownServiceException("VRS: Location is not streamreadable:" + node);
    }
}
VRLConnection.java 文件源码 项目:vbrowser 阅读 14 收藏 0 点赞 0 评论 0
public OutputStream getOutputStream() throws IOException
{
    if (this.connected == false)
        connect();

    if (node instanceof VStreamReadable)
    {
        return ((VStreamWritable) node).createOutputStream();
    }
    else if (node instanceof VDir)
    {
        // Directories do not have stream read methods.
        // possibly the 'index.html' file is meant, but
        // here we don't know what the caller wants.
        throw new UnknownServiceException("VRS: Location is a directory:" + node);
    }
    else
    {
        throw new UnknownServiceException("VRS: location is not streamwritable:" + node);
    }
}
ConnectionSpecSelector.java 文件源码 项目:GitHub 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Configures the supplied {@link SSLSocket} to connect to the specified host using an appropriate
 * {@link ConnectionSpec}. Returns the chosen {@link ConnectionSpec}, never {@code null}.
 *
 * @throws IOException if the socket does not support any of the TLS modes available
 */
public ConnectionSpec configureSecureSocket(SSLSocket sslSocket) throws IOException {
  ConnectionSpec tlsConfiguration = null;
  for (int i = nextModeIndex, size = connectionSpecs.size(); i < size; i++) {
    ConnectionSpec connectionSpec = connectionSpecs.get(i);
    if (connectionSpec.isCompatible(sslSocket)) {
      tlsConfiguration = connectionSpec;
      nextModeIndex = i + 1;
      break;
    }
  }

  if (tlsConfiguration == null) {
    // This may be the first time a connection has been attempted and the socket does not support
    // any the required protocols, or it may be a retry (but this socket supports fewer
    // protocols than was suggested by a prior socket).
    throw new UnknownServiceException(
        "Unable to find acceptable protocols. isFallback=" + isFallback
            + ", modes=" + connectionSpecs
            + ", supported protocols=" + Arrays.toString(sslSocket.getEnabledProtocols()));
  }

  isFallbackPossible = isFallbackPossible(sslSocket);

  Internal.instance.apply(tlsConfiguration, sslSocket, isFallback);

  return tlsConfiguration;
}
ConnectionSpecSelector.java 文件源码 项目:GitHub 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Configures the supplied {@link SSLSocket} to connect to the specified host using an appropriate
 * {@link ConnectionSpec}. Returns the chosen {@link ConnectionSpec}, never {@code null}.
 *
 * @throws IOException if the socket does not support any of the TLS modes available
 */
public ConnectionSpec configureSecureSocket(SSLSocket sslSocket) throws IOException {
  ConnectionSpec tlsConfiguration = null;
  for (int i = nextModeIndex, size = connectionSpecs.size(); i < size; i++) {
    ConnectionSpec connectionSpec = connectionSpecs.get(i);
    if (connectionSpec.isCompatible(sslSocket)) {
      tlsConfiguration = connectionSpec;
      nextModeIndex = i + 1;
      break;
    }
  }

  if (tlsConfiguration == null) {
    // This may be the first time a connection has been attempted and the socket does not support
    // any the required protocols, or it may be a retry (but this socket supports fewer
    // protocols than was suggested by a prior socket).
    throw new UnknownServiceException(
        "Unable to find acceptable protocols. isFallback=" + isFallback
            + ", modes=" + connectionSpecs
            + ", supported protocols=" + Arrays.toString(sslSocket.getEnabledProtocols()));
  }

  isFallbackPossible = isFallbackPossible(sslSocket);

  Internal.instance.apply(tlsConfiguration, sslSocket, isFallback);

  return tlsConfiguration;
}
NbinstURLStreamHandler.java 文件源码 项目:incubator-netbeans 阅读 15 收藏 0 点赞 0 评论 0
public void connect() throws IOException {
    if (f == null) {
        f = NbinstURLMapper.decodeURL(url);
        if (f == null) {
            throw new FileNotFoundException("Cannot find: " + url); // NOI18N
        }
    }
    if (!f.isFile()) {
        throw new UnknownServiceException();
    }
}
FileURL.java 文件源码 项目:incubator-netbeans 阅读 15 收藏 0 点赞 0 评论 0
public OutputStream getOutputStream() throws IOException, UnknownServiceException {
    connect();

    if (fo.isFolder()) {
        throw new UnknownServiceException();
    }

    if (oStream == null) {
        FileLock flock = fo.lock();
        oStream = new LockOS(fo.getOutputStream(flock), flock);
    }

    return oStream;
}
SourceConnection.java 文件源码 项目:incubator-netbeans 阅读 16 收藏 0 点赞 0 评论 0
public @Override InputStream getInputStream() throws IOException, UnknownServiceException {
    connect();

    if (iStream == null) {
        if (fo.isFolder()) {
            throw new FileNotFoundException("Can not read from a folder.");
        } else {
            iStream = fo.getInputStream();
        }
    }

    return iStream;
}
WebForm.java 文件源码 项目:lams 阅读 20 收藏 0 点赞 0 评论 0
protected WebResponse submitRequest( String event, WebRequest request ) throws IOException, SAXException {
    try {
        return super.submitRequest( event, request );
    } catch (UnknownServiceException e) {
        throw new UnsupportedActionException( "HttpUnit does not support " + request.getURL().getProtocol() + " URLs in form submissions" );
    }
}
ConnectionSpecSelector.java 文件源码 项目:PriorityOkHttp 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Configures the supplied {@link SSLSocket} to connect to the specified host using an appropriate
 * {@link ConnectionSpec}. Returns the chosen {@link ConnectionSpec}, never {@code null}.
 *
 * @throws IOException if the socket does not support any of the TLS modes available
 */
public ConnectionSpec configureSecureSocket(SSLSocket sslSocket) throws IOException {
  ConnectionSpec tlsConfiguration = null;
  for (int i = nextModeIndex, size = connectionSpecs.size(); i < size; i++) {
    ConnectionSpec connectionSpec = connectionSpecs.get(i);
    if (connectionSpec.isCompatible(sslSocket)) {
      tlsConfiguration = connectionSpec;
      nextModeIndex = i + 1;
      break;
    }
  }

  if (tlsConfiguration == null) {
    // This may be the first time a connection has been attempted and the socket does not support
    // any the required protocols, or it may be a retry (but this socket supports fewer
    // protocols than was suggested by a prior socket).
    throw new UnknownServiceException(
        "Unable to find acceptable protocols. isFallback=" + isFallback
            + ", modes=" + connectionSpecs
            + ", supported protocols=" + Arrays.toString(sslSocket.getEnabledProtocols()));
  }

  isFallbackPossible = isFallbackPossible(sslSocket);

  Internal.instance.apply(tlsConfiguration, sslSocket, isFallback);

  return tlsConfiguration;
}
ConnectionSpecSelector.java 文件源码 项目:Okhttp 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Configures the supplied {@link SSLSocket} to connect to the specified host using an appropriate
 * {@link ConnectionSpec}. Returns the chosen {@link ConnectionSpec}, never {@code null}.
 *
 * @throws IOException if the socket does not support any of the TLS modes available
 */
public ConnectionSpec configureSecureSocket(SSLSocket sslSocket) throws IOException {
  ConnectionSpec tlsConfiguration = null;
  for (int i = nextModeIndex, size = connectionSpecs.size(); i < size; i++) {
    ConnectionSpec connectionSpec = connectionSpecs.get(i);
    if (connectionSpec.isCompatible(sslSocket)) {
      tlsConfiguration = connectionSpec;
      nextModeIndex = i + 1;
      break;
    }
  }

  if (tlsConfiguration == null) {
    // This may be the first time a connection has been attempted and the socket does not support
    // any the required protocols, or it may be a retry (but this socket supports fewer
    // protocols than was suggested by a prior socket).
    throw new UnknownServiceException(
        "Unable to find acceptable protocols. isFallback=" + isFallback
            + ", modes=" + connectionSpecs
            + ", supported protocols=" + Arrays.toString(sslSocket.getEnabledProtocols()));
  }

  isFallbackPossible = isFallbackPossible(sslSocket);

  Internal.instance.apply(tlsConfiguration, sslSocket, isFallback);

  return tlsConfiguration;
}
TcpCollectorTest.java 文件源码 项目:monsoon 阅读 14 收藏 0 点赞 0 评论 0
@Test
public void connectServiceError() throws Exception {
    Mockito.doThrow(new UnknownServiceException()).when(mockSocket).connect(Mockito.any());

    final TcpCollector.ConnectDatum result;
    try (TcpCollector tcpCollector = new TcpCollector(dstAddress, GROUP)) {
        result = tcpCollector.tryConnect(mockSocket);
    }

    assertThat(result.getResult(), equalTo(TcpCollector.ConnectResult.UNKNOWN_SERVICE));
    Mockito.verify(mockSocket, times(1)).connect(Mockito.eq(dstAddress));
    Mockito.verifyNoMoreInteractions(mockSocket);
}
ConnectionSpecSelector.java 文件源码 项目:AndroidProjects 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Configures the supplied {@link SSLSocket} to connect to the specified host using an appropriate
 * {@link ConnectionSpec}. Returns the chosen {@link ConnectionSpec}, never {@code null}.
 *
 * @throws IOException if the socket does not support any of the TLS modes available
 */
public ConnectionSpec configureSecureSocket(SSLSocket sslSocket) throws IOException {
  ConnectionSpec tlsConfiguration = null;
  for (int i = nextModeIndex, size = connectionSpecs.size(); i < size; i++) {
    ConnectionSpec connectionSpec = connectionSpecs.get(i);
    if (connectionSpec.isCompatible(sslSocket)) {
      tlsConfiguration = connectionSpec;
      nextModeIndex = i + 1;
      break;
    }
  }

  if (tlsConfiguration == null) {
    // This may be the first time a connection has been attempted and the socket does not support
    // any the required protocols, or it may be a retry (but this socket supports fewer
    // protocols than was suggested by a prior socket).
    throw new UnknownServiceException(
        "Unable to find acceptable protocols. isFallback=" + isFallback
            + ", modes=" + connectionSpecs
            + ", supported protocols=" + Arrays.toString(sslSocket.getEnabledProtocols()));
  }

  isFallbackPossible = isFallbackPossible(sslSocket);

  Internal.instance.apply(tlsConfiguration, sslSocket, isFallback);

  return tlsConfiguration;
}
ConnectionSpecSelector.java 文件源码 项目:AndroidAppLib 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Configures the supplied {@link SSLSocket} to connect to the specified host using an appropriate
 * {@link ConnectionSpec}. Returns the chosen {@link ConnectionSpec}, never {@code null}.
 *
 * @throws IOException if the socket does not support any of the TLS modes available
 */
public ConnectionSpec configureSecureSocket(SSLSocket sslSocket) throws IOException {
    ConnectionSpec tlsConfiguration = null;
    for (int i = nextModeIndex, size = connectionSpecs.size(); i < size; i++) {
        ConnectionSpec connectionSpec = connectionSpecs.get(i);
        if (connectionSpec.isCompatible(sslSocket)) {
            tlsConfiguration = connectionSpec;
            nextModeIndex = i + 1;
            break;
        }
    }

    if (tlsConfiguration == null) {
        // This may be the first time a connection has been attempted and the socket does not support
        // any the required protocols, or it may be a retry (but this socket supports fewer
        // protocols than was suggested by a prior socket).
        throw new UnknownServiceException(
                "Unable to find acceptable protocols. isFallback=" + isFallback
                        + ", modes=" + connectionSpecs
                        + ", supported protocols=" + Arrays.toString(sslSocket.getEnabledProtocols()));
    }

    isFallbackPossible = isFallbackPossible(sslSocket);

    Internal.instance.apply(tlsConfiguration, sslSocket, isFallback);

    return tlsConfiguration;
}
Announce.java 文件源码 项目:PiratePlayar 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Create a {@link TrackerClient} annoucing to the given tracker address.
 *
 * @param torrent The torrent the tracker client will be announcing for.
 * @param peer The peer the tracker client will announce on behalf of.
 * @param tracker The tracker address as a {@link URI}.
 * @throws UnknownHostException If the tracker address is invalid.
 * @throws UnknownServiceException If the tracker protocol is not supported.
 */
private TrackerClient createTrackerClient(SharedTorrent torrent, Peer peer,
    URI tracker) throws UnknownHostException, UnknownServiceException {
    String scheme = tracker.getScheme();

    if ("http".equals(scheme) || "https".equals(scheme)) {
        return new HTTPTrackerClient(torrent, peer, tracker);
    } else if ("udp".equals(scheme)) {
        return new UDPTrackerClient(torrent, peer, tracker);
    }

    throw new UnknownServiceException(
        "Unsupported announce scheme: " + scheme + "!");
}
ResourceOutputTest.java 文件源码 项目:ant 阅读 22 收藏 0 点赞 0 评论 0
@Test
public void testurloutput() throws IOException {
    File f = project.resolveFile("testurloutput");
    try {
        FILE_UTILS.createNewFile(f);
        testoutput(new URLResource(f));
        fail("should have caught UnknownServiceException");
    } catch (UnknownServiceException e) {
        //TODO assert exception message
    } finally {
        if (!f.delete()) {
            f.deleteOnExit();
        }
    }
}
UnknownServiceExceptionTest.java 文件源码 项目:cn1 阅读 14 收藏 0 点赞 0 评论 0
/**
 * @tests java.net.UnknownServiceException#UnknownServiceException()
 */
public void test_Constructor() {
    try {
        if (true) {
            throw new UnknownServiceException();
        }
        fail("Exception not thrown");
    } catch (UnknownServiceException e) {
        // Expected
    }
}
UnknownServiceExceptionTest.java 文件源码 项目:cn1 阅读 14 收藏 0 点赞 0 评论 0
/**
 * @tests java.net.UnknownServiceException#UnknownServiceException(java.lang.String)
 */
public void test_ConstructorLjava_lang_String() {
    try {
        if (true) {
            throw new UnknownServiceException("test");
        }
        fail("Constructor failed");
    } catch (UnknownServiceException e) {
        assertEquals("Wrong exception message", "test", e.getMessage());
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号