本文整理了Java中com.squareup.okhttp.mockwebserver.MockWebServer.getPort()
方法的一些代码示例,展示了MockWebServer.getPort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MockWebServer.getPort()
方法的具体详情如下:
包路径:com.squareup.okhttp.mockwebserver.MockWebServer
类名称:MockWebServer
方法名:getPort
暂无
代码示例来源:origin: com.squareup.okhttp/mockwebserver
public Proxy toProxyAddress() {
maybeStart();
InetSocketAddress address = new InetSocketAddress(inetSocketAddress.getAddress(), getPort());
return new Proxy(Proxy.Type.HTTP, address);
}
代码示例来源:origin: apache/jclouds
@Override public String region(String host) {
for (Map.Entry<String, MockWebServer> regionToServer : regionToServers.entrySet()) {
MockWebServer server = regionToServer.getValue();
if (host.equals(server.getHostName() + ":" + regionToServer.getValue().getPort())) {
return regionToServer.getKey();
}
}
throw new IllegalStateException(host + " not found");
}
};
代码示例来源:origin: com.squareup.okhttp/mockwebserver
/**
* Returns a URL for connecting to this server.
*
* @param path the request path, such as "/".
*/
public HttpUrl url(String path) {
return new HttpUrl.Builder()
.scheme(sslSocketFactory != null ? "https" : "http")
.host(getHostName())
.port(getPort())
.build()
.resolve(path);
}
代码示例来源:origin: cfg4j/cfg4j
@Test
void getConfigurationThrowsBeforeInitCalled() {
source = new ConsulConfigurationSourceBuilder()
.withHost(server.getHostName())
.withPort(server.getPort())
.build();
assertThatThrownBy(() -> source.getConfiguration(new ImmutableEnvironment("")))
.isExactlyInstanceOf(IllegalStateException.class);
}
代码示例来源:origin: cfg4j/cfg4j
@Test
void initThrowsOnConnectionFailure() throws Exception {
server.shutdown();
source = new ConsulConfigurationSourceBuilder()
.withHost(server.getHostName())
.withPort(server.getPort())
.build();
assertThatThrownBy(() -> source.init())
.isExactlyInstanceOf(SourceCommunicationException.class);
}
代码示例来源:origin: cfg4j/cfg4j
@Test
void readsConfigsFromConsulConfigurationSource() {
ConfigurationSource source = new ConsulConfigurationSourceBuilder()
.withHost(server.getHostName())
.withPort(server.getPort())
.build();
ConfigurationProvider provider = new ConfigurationProviderBuilder()
.withConfigurationSource(source)
.withEnvironment(new ImmutableEnvironment("us-west-1"))
.build();
assertThat(provider.getProperty("featureA.toggle", String.class)).isEqualTo("disabled");
}
代码示例来源:origin: cfg4j/cfg4j
@BeforeEach
void setUp() throws Exception {
dispatcher = new ModifiableDispatcher();
runMockServer();
source = new ConsulConfigurationSourceBuilder()
.withHost(server.getHostName())
.withPort(server.getPort())
.build();
source.init();
}
内容来源于网络,如有侵权,请联系作者删除!