当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionIOException类代码示例

本文整理汇总了Java中com.subgraph.orchid.ConnectionIOException的典型用法代码示例。如果您正苦于以下问题:Java ConnectionIOException类的具体用法?Java ConnectionIOException怎么用?Java ConnectionIOException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConnectionIOException类属于com.subgraph.orchid包,在下文中一共展示了ConnectionIOException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendCell

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
public void sendCell(Cell cell) throws ConnectionIOException  {
	if(!socket.isConnected()) {
		throw new ConnectionIOException("Cannot send cell because connection is not connected");
	}
	updateLastActivity();
	outputLock.lock();
	try {
		try {
			output.write(cell.getCellBytes());
		} catch (IOException e) {
			logger.fine("IOException writing cell to connection "+ e.getMessage());
			closeSocket();
			throw new ConnectionIOException(e.getClass().getName() + " : "+ e.getMessage());
		}
	} finally {
		outputLock.unlock();
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:19,代码来源:ConnectionImpl.java

示例2: runHandshake

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
void runHandshake() throws IOException, InterruptedException, ConnectionIOException {
	// Swap in V1-only ciphers for second handshake as a workaround for:
	//
	//     https://trac.torproject.org/projects/tor/ticket/4591
	// 
	socket.setEnabledCipherSuites(ConnectionSocketFactory.V1_CIPHERS_ONLY);
	
	final HandshakeFinishedMonitor monitor = new HandshakeFinishedMonitor();
	socket.addHandshakeCompletedListener(monitor);
	socket.startHandshake();
	monitor.waitFinished();
	socket.removeHandshakeCompletedListener(monitor);
	
	verifyIdentityKey(getIdentityKey());
	sendVersions(2);
	receiveVersions();
	sendNetinfo();
	recvNetinfo();
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:20,代码来源:ConnectionHandshakeV2.java

示例3: doConnect

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
private void doConnect() throws IOException, InterruptedException, ConnectionIOException {
	connectSocket();
	final ConnectionHandshake handshake = ConnectionHandshake.createHandshake(config, this, socket);
	input = socket.getInputStream();
	output = socket.getOutputStream();
	readCellsThread.start();
	handshake.runHandshake();
	updateLastActivity();
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:10,代码来源:ConnectionImpl.java

示例4: readConnectionControlCell

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
Cell readConnectionControlCell() throws ConnectionIOException {
	try {
		return connectionControlCells.take();
	} catch (InterruptedException e) {
		closeSocket();
		throw new ConnectionIOException();
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:ConnectionImpl.java

示例5: runHandshake

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
void runHandshake() throws IOException, InterruptedException, ConnectionIOException {
	sendVersions(3);
	receiveVersions();
	recvCerts();
	recvAuthChallengeAndNetinfo();
	verifyCertificates();
	sendNetinfo();
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:ConnectionHandshakeV3.java

示例6: expectCell

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
protected Cell expectCell(Integer... expectedTypes) throws ConnectionHandshakeException {
	try {
		final Cell c = connection.readConnectionControlCell();
		for(int t: expectedTypes) {
			if(c.getCommand() == t) {
				return c;
			}
		}
		final List<Integer> expected = Arrays.asList(expectedTypes);
		throw new ConnectionHandshakeException("Expecting Cell command "+ expected + " and got [ "+ c.getCommand() +" ] instead");
	} catch (ConnectionIOException e) {
		throw new ConnectionHandshakeException("Connection exception while performing handshake "+ e);
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:15,代码来源:ConnectionHandshake.java

示例7: sendVersions

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
protected  void sendVersions(int... versions) throws ConnectionIOException {
	final Cell cell = CellImpl.createVarCell(0, Cell.VERSIONS, versions.length * 2);
	for(int v: versions) {
		cell.putShort(v);
	}
	connection.sendCell(cell);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:8,代码来源:ConnectionHandshake.java

示例8: sendNetinfo

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
protected void sendNetinfo() throws ConnectionIOException {
	final Cell cell = CellImpl.createCell(0, Cell.NETINFO);
	putTimestamp(cell);
	putIPv4Address(cell, connection.getRouter().getAddress());
	putMyAddresses(cell);
	connection.sendCell(cell);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:8,代码来源:ConnectionHandshake.java

示例9: sendCell

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
void sendCell(Cell cell) {
	final CircuitStatus status = circuit.getStatus();
	if(!(status.isConnected() || status.isBuilding()))
		return;
	try {
		status.updateDirtyTimestamp();
		connection.sendCell(cell);
	} catch (ConnectionIOException e) {
		destroyCircuit();
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:12,代码来源:CircuitIO.java

示例10: sendDestroyCell

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
void sendDestroyCell(int reason) {
	Cell destroy = CellImpl.createCell(circuitId, Cell.DESTROY);
	destroy.putByte(reason);
	try {
		connection.sendCell(destroy);
	} catch (ConnectionIOException e) {
		logger.warning("Connection IO error sending DESTROY cell: "+ e.getMessage());
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:10,代码来源:CircuitIO.java

示例11: sendCell

import com.subgraph.orchid.ConnectionIOException; //导入依赖的package包/类
public void sendCell(Cell cell) throws ConnectionIOException  {
	if(!socket.isConnected()) {
		throw new ConnectionIOException("Cannot send cell because connection is not connected");
	}
	updateLastActivity();
	synchronized(output) {
		try {
			output.write(cell.getCellBytes());
		} catch (IOException e) {
			logger.fine("IOException writing cell to connection "+ e.getMessage());
			closeSocket();
			throw new ConnectionIOException(e.getClass().getName() + " : "+ e.getMessage());
		}
	}
}
 
开发者ID:HashEngineering,项目名称:quarkcoinj,代码行数:16,代码来源:ConnectionImpl.java


注:本文中的com.subgraph.orchid.ConnectionIOException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。